![]() ![]() I wonder if there is some "best practice" from which I am deviating by attempting this structure. The cmake-gui (1) offers interactive selection of a generator when creating a new build tree. 100') 11 Set target IN LISTS name dirs) to directory name with any 12 spaces changed. Use its -G option to specify the generator for a new build tree. 7 8 list(APPEND Create CMake projects a list of to the be. The cmake (1) command-line tool -help output lists available generators on the current platform. If code is divided into folders, it is usually is divided into corresponding libraries. CMake Generators are platform-specific so each may be available only on certain platforms. Then call that build system to actually compile/link the project: cmake -build. Libs can define their compile flags as PRIVATE, PUBLIC or INTERFACE.PRIVATE basically means the flags are only applied to this library.PUBLIC and INTERFACE flags are also applied to any target which links to it (i.e. Source file structures are usually flat within a project Next, navigate to the build directory and run CMake to configure the project and generate a native build system: cd Step1build cmake. I linked to the docs in my answer, but its really only useful for libraries rather than exes. Looking for examples and at the cmake tutorial has led me to the conclusion that: Using some message() statements, I have found that the the child folder will get the contents of the SOURCE variable, but it's new assignment to that variable will not persist on returning to the parent CMakeLists.txt ![]() Then in project/source/folder1/CMakeLists.txt: set(SOURCE In project/source/CMakelists.txt: set(SOURCE I do not know how to tell cmake to go down a directory, then add the source in that directory to project defined in the parent directory. Exercises: 15 min Questions How do targets work Objectives Know how to set up targets Understand linking and INTERFACE properties Make INTERFACE targets Targets Now you know how to compile a single file using three lines of CMake. ![]() I have project which has not been divided into libraries, but the source is organized in a directory tree. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |