I have a project that I am porting to cmake. The architecture of the sources is as follow:
src
|- FolderA
|-fileAa.cpp
|-fileAb.cpp
...
|- fileA.cpp
|-CMakeLists.txt
...
The file fileA.cpp
is as follow:
#include <FolderA/fileAa.cpp>
#include <FolderA/fileAb.cpp>
//etc
My CMakeFiles.txt
is as follow (the files from FolderA
ARE NOT included in the add_library
function)
#...
add_library(... fileA.cpp ...)
#...
And it works well. When I tried to build the library, if I modify any files inside FolderA
, only the file fileA.cpp
is rebuilt and the library is remade.
However, when I generate my project for Xcode, the files inside FolderA are not shown. Is there a way to tell cmake that I want it to include the files inside FolderA
in my Xcode project (and any other supported IDE) but without adding them to the list of files to compile for the add_library
function?
I tried to set the property of the files in FolderA
as HEADER and still include them in add_library
(as mentioned here) and it sort of worked, but in Xcode the files were displayed in a flat hierarchy and I would like to keep the same structure:
What I want in Xcode:
|-FolderA
|-fileAa.cpp
|-fileAb.cpp
...
|- fileA.cpp
What I have in Xcode:
|-fileAa.cpp
|-fileAb.cpp
|-fileA.cpp
...
I there a way to tell cmake to include a folder and its content to the project generated for an IDE, without adding the files I want to the list of files to compile ?