Reputation: 344
I have a C++ project with submodule another_repo
:
.
├── CMakeLists.txt
├── ext
│ └── another_repo
│ └── CMakeLists.txt
├── include
└── src
I would like to build only part of another_repo
. That said, I need a new, customized CMakeLists.txt
to build another_repo
, instead of using its original one ./ext/another_repo/CMakeLists.txt
.
But how can I do this in the root directory ./CMakeLists.txt
?
Upvotes: 1
Views: 812
Reputation: 9331
If you want to build only a part of another_repo
then just create a new target which only build the part you want.
For e.g, another_repo
has following files:
another_repo/
│── a.cpp
│── b.cpp
│── c.cpp
And you want to build only a.cpp
and b.cpp
(assuming they don't depend on c.cpp
).
In you root directory CMakeLists.txt
:
...
set(ANOTHER ext/another_repo)
add_library(part_of_another_repo ${ANOTHER}/a.cpp ${ANOTHER}/b.cpp)
#or add_executable() if it is an executable
...
Upvotes: 2