[CMake] how to set current source directory relative to external project
hex
hex7c3 at gmail.com
Tue Jul 9 07:30:15 EDT 2019
hello CMake community,
I am experimenting with external projects. I have documentation in an
external project which is generated in `${CMAKE_CURRENT_SOURCE_DIR}`.
When I add the external project, however, it is using
`${CMAKE_CURRENT_SOURCE_DIR}` of the "super build".
I need `${CMAKE_CURRENT_SOURCE_DIR}` to be equal to `${SOURCE_DIR}`,
where the former is seen by the external project and the latter by the
"super build".
Example:
message("${CMAKE_CURRENT_SOURCE_DIR} = /home/user/super")
ExternalProject_Add(ext1
# directory options
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext1"
)
${CMAKE_CURRENT_SOURCE_DIR}/ext1/CMakeLists.txt:
message("${CMAKE_CURRENT_SOURCE_DIR} = /home/user/super/ext1")
More information about the CMake
mailing list