![]() While you have the main.f90 file in this directory, I would find it surprising to have the main program compiled here, but its modules stored in the top-level instead, therefore I’m just collecting main.f90 like every other source and handle the compilation in the top-level. Finally, you have to pass the appended source files up again to the PARENT_SCOPE. My personal preference is to define targets, at least libraries, in the top-level, it makes it easier to inspect the top-level CMakeLists.txt and know what the build actually does, while most of the subdirectories only collect sources and pass them back up to the top-level.įor each subdirectory I’m usually defining the current directory as local variable because I don’t want to type CMAKE_CURRENT_SOURCE_DIR every time. Set(CMAKE_Fortran_MODULE_DIRECTORY $/mod" My top-level CMakeLists.txt is: # my_cool_project/CMakeLists.txt ![]() I am struggling to write a CMakeLists.txt that automagically figures out the dependency graph and builds the main program. There are dependencies between the directories, such that each one cannot be built independently. Some of these source files define modules, while others are naked subroutines. The main program is written in main.f90, which calls subroutines defined in the other source files. I’ve got a project that has the following directory structure my_cool_project/ ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |