I have a CMake project named proj1
, which I want to use as an external project in another project, proj2
. Now, the (relevant) command in proj1
's CMakeLists.txt
is:
install(
TARGETS proj1
ARCHIVE
DESTINATION lib
EXPORT proj1_library
INCLUDES DESTINATION include
CONFIGURATIONS Release RelWithDebugInfo
)
and I want to use this static library in proj2
, without explicitly "guessing" where it's installed to be proj1
. I want to be able to get obtain this target from proj1
(which I obtain using ExternalProject
), then use it - directly or indirectly - in add_target_libraries()
commands.
How should I do that? And - do I only need to make changes to proj2
or also to proj1
's CMakeLists.txt
?