Fortran recordsdata included in .f90 recordsdata will not be allowed to be added in cmake add_libray or set operate


Hello supporter, just lately I met a really unusual drawback when constructing fortran codes by cmake in home windows or linux. I have no idea whether or not it’s a drawback in cmake or fortran compiler.  I’ve enclosed one demo codes within the enclosure.

Nonetheless, after I modify the add_library(demolib DEMO.f90 enjoyable.f90) within the authentic CMakeLists.txt to add_library(demolib DEMO.f90). “make” run OK after eradicating “enjoyable.f90”. Why “enjoyable.f90” can’t be included within the Cmake add_library?

Apart from, once I change add_library(demolib DEMO.f90 enjoyable.f90) to

set(LIB_SOURCES DEMO.f90 enjoyable.f90)
add_library(demolib ${LIB_SOURCES})

similar error will happen. Can somebody clarify the rationale behind this?

Leave a Reply

Your email address will not be published. Required fields are marked *