multiple Cmake in a single project


I am working on a project with multiple CMakes. In the main directory, we have "CMakeLists.txt" which builds the program, under "test" directory, we have another "CMakeLists.txt" that tests the app once it is built, and under "examples" directory we have another CMakeLists.txt which builds examples using the built program.


The project directory graph is:



|-- CMakeLists.txt

|-- test

       |-- CMakeLists.txt

|-- examples

        |-- CMakeLists.txt


How do I properly configure project with multiple build targets located in different directories? If I run "Load Cmake Porject" for a particular CMake file, then it seems to unload other Cmake files.

1 comment


Are the test and examples subfolders added in the top-level CMakeLists.txt as subprojects (using add_subdirectory())? If yes, please close your project (File | Close Project), delete all .idea subfolders that have beed created in your project folder and subfolders, in CLion on the Welcome Screen choose "Open" and select the program_directory (in which the top-level CMakeLists.txt and the test and examples subfolders are located).


Please sign in to leave a comment.