
I wonder if there is some "best practice" from which I am deviating by attempting this structure. If code is divided into folders, it is usually is divided into corresponding libraries. Source file structures are usually flat within a project

Looking for examples and at the cmake tutorial has led me to the conclusion that: They can either be assigned to a source file. 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 1 Im working on a C++ project that uses wxWidgets with a CMake script I wrote to resolve this dependency when I build it. This is the documentation for the properties supported by CMake. Source file properties are visible only to targets added in the same directory (CMakeLists.txt). See properties documentation for those known to CMake. See Properties on Source Files for the list of properties known to CMake. See also the setproperty (SOURCE) command. Use getsourcefileproperty () to get property values.

In project/source/CMakelists.txt: set(SOURCE As the docs state, the properties on source files can only be set from the directory in which the target consuming that source file is defined.

#Cmake set source file porperties how to#
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. I have project which has not been divided into libraries, but the source is organized in a directory tree.
