我在基于CMake的库中使用ExternalProject_Add
()。
ExternalProject_Add(somelib
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/packages/somelib
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/somelib
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/somelib
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/packages/usr
TEST_COMMAND make test
DEPENDS something1 something2 something3
)
但是我不喜欢在make test
中调用TEST_COMMAND
的方式。当我不决定使用Makefile生成器或类似的生成器时该怎么办呢?到TEST_COMMAND ${CTEST_COMMAND}
就可以了,但是没有。在其他项目中,我已经可以使用INSTALL_COMMAND ${CMAKE_COMMAND} ARGS -E copy "somefile" "somedestination"
了,但是在这种情况下,${CTEST_COMMAND}
什么也没做。
完成后,我正在想象这样的事情:
ExternalProject_Add(somelib
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/packages/somelib
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/somelib
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/somelib
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/packages/usr
TEST_COMMAND ${CTEST_COMMAND}
DEPENDS something1 something2 something3
)