# A very strange make problem existed in Cmake add\_library functions

**URL:** <https://discourse.cmake.org/t/a-very-strange-make-problem-existed-in-cmake-add-library-functions/10837>\
**Category:** Code\
**Tags:** os:linux, os:windows\
**Created:** [May 11, 2024, 8:35am UTC](https://discourse.cmake.org/t/a-very-strange-make-problem-existed-in-cmake-add-library-functions/10837 "2024-05-11T08:35:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junru](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@Junru](https://discourse.cmake.org/u/Junru)\
**Post date:** [May 11, 2024, 8:35am UTC](https://discourse.cmake.org/t/a-very-strange-make-problem-existed-in-cmake-add-library-functions/10837/1 "2024-05-11T08:35:10Z")

</div>

Hi friends,

Is there anyone who met the strange problem when making project on the linux or win system?  
[demotest.zip](https://discourse.cmake.org/uploads/short-url/x2fn6Dj5rJmEbDWb8HbfqpZGF8Z.zip) (1.2 KB)

Cmake on the linux platform:

 ![image](https://discourse.cmake.org/uploads/default/original/2X/f/f7b62b9f94dd0481cceaffbfb85afa651dba70fc.jpeg)

Cmake on the windows platform:

 ![image](https://discourse.cmake.org/uploads/default/original/2X/9/9d6f55011845d7e16a03cd93ba4328d4c6871895.png)

However, after I change the add\_library(demolib DEMO.f90 fun.f90) in the original CMakeLists.txt to add\_library(demolib DEMO.f90). “make” run OK after removing “fun.f90”. Why “fun.f90” cannot be included in the Cmake add\_library?

Besides, when I replace add\_library(demolib DEMO.f90 fun.f90) to

set(LIB\_SOURCES DEMO.f90 fun.f90)  
add\_library(demolib ${LIB\_SOURCES})

same error will occur. Can someone explain the reason behind this?
