CMake: Use IMPORTED target for Boost

This commit is contained in:
Yuri Kunde Schlesner 2017-05-27 19:21:06 -07:00
parent 4660bc1c78
commit 0f563111a2
4 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,5 @@
# CMake 3.5 required for support for IMPORTED find_package libraries # CMake 3.6 required for FindBoost to define IMPORTED libs properly on unknown Boost versions
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.6)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
function(download_bundled_external remote_path lib_name prefix_var) function(download_bundled_external remote_path lib_name prefix_var)
@ -135,12 +135,14 @@ if (NOT PNG_FOUND)
message(STATUS "libpng not found. Some debugging features have been disabled.") message(STATUS "libpng not found. Some debugging features have been disabled.")
endif() endif()
find_package(Boost 1.57.0 QUIET) find_package(Boost 1.63.0 QUIET)
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
message(STATUS "Boost 1.57.0 or newer not found, falling back to externals") message(STATUS "Boost 1.63.0 or newer not found, falling back to externals")
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost")
set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost")
set(Boost_NO_SYSTEM_PATHS OFF)
find_package(Boost QUIET REQUIRED)
endif() endif()
include_directories(${Boost_INCLUDE_DIR})
# Include bundled CMake modules # Include bundled CMake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules")

View File

@ -92,7 +92,7 @@ else()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
endif() endif()
target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core) target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core)
target_link_libraries(citra-qt PRIVATE ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS} glad) target_link_libraries(citra-qt PRIVATE ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS} Boost::boost glad)
target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)

View File

@ -95,6 +95,7 @@ endif()
create_directory_groups(${SRCS} ${HEADERS}) create_directory_groups(${SRCS} ${HEADERS})
add_library(common STATIC ${SRCS} ${HEADERS}) add_library(common STATIC ${SRCS} ${HEADERS})
target_link_libraries(common PUBLIC Boost::boost)
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)
target_link_libraries(common PRIVATE xbyak) target_link_libraries(common PRIVATE xbyak)
endif() endif()

View File

@ -381,4 +381,4 @@ create_directory_groups(${SRCS} ${HEADERS})
add_library(core STATIC ${SRCS} ${HEADERS}) add_library(core STATIC ${SRCS} ${HEADERS})
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
target_link_libraries(core PRIVATE cryptopp dynarmic) target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp dynarmic)