./
CMakeLists.txt
externals/
|---CMakeLists.txt
|---boost/
|---dynatmic/
|---|---CMakeLists.txt
Note that the boost directory doesn't have a CMakeLists.txt. Its sources are set in externals/CMakeLists.txt.
Relevant part of root CMakeLists.txt
Code: Select all
add_subdirectory(externals)
add_library(Boost::boost ALIAS boost)
Code: Select all
set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "")
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "")
set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "")
add_library(boost INTERFACE)
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR})
What I want is to move the ALIAS line from the root CMakeLists.txt to the one in externals/. However when I move this line and run cmake I get:
Code: Select all
-- Configuring done (1.2s)
CMake Error: install(EXPORT "dynarmicTargets" ...) includes target "dynarmic" which requires target "boost" that is not in any export set.
-- Generating done (0.2s)
CMake Generate step failed. Build files cannot be regenerated correctly.
Code: Select all
install(TARGETS dynarmic EXPORT dynarmicTargets)
install(EXPORT dynarmicTargets
NAMESPACE dynarmic::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)