From 9906be746fdb9a22446c569a5cc18e35167fbf21 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 3 Mar 2017 22:09:28 -0500 Subject: [PATCH] CMakeLists: Make boost an interface library target Gets rid of the use of a non-target include and makes libraries explicitly link against the identifier name in order to get includes. --- .appveyor.yml | 2 +- .travis/build.sh | 4 ++-- CMakeLists.txt | 3 ++- src/CMakeLists.txt | 4 +--- tests/CMakeLists.txt | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 2047f6a6..f39787d3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,7 +18,7 @@ install: before_build: - mkdir build - cd build - - cmake .. -G "Visual Studio 14 2015 Win64" -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=externals/boost + - cmake .. -G "Visual Studio 14 2015 Win64" -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=%cd%/../externals/boost - cd .. build: diff --git a/.travis/build.sh b/.travis/build.sh index d1a65b13..712f5371 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -11,7 +11,7 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH mkdir build && cd build - cmake .. -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=externals/ext-boost + cmake .. -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost make -j4 ctest -VV -C Release @@ -21,6 +21,6 @@ elif [ "$TRAVIS_OS_NAME" = "osx" ]; then export MACOSX_DEPLOYMENT_TARGET=10.9 mkdir build && cd build - cmake .. -GXcode -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=externals/ext-boost -DDYNARMIC_TESTS=0 + cmake .. -GXcode -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DDYNARMIC_TESTS=0 xcodebuild -configuration Release fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a8ca3db..96456ce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,8 @@ else() message(FATAL_ERROR "Please provide a path to a boost installation using Boost_INCLUDE_DIRS") endif() endif() -include_directories(${Boost_INCLUDE_DIRS}) +add_library(boost INTERFACE IMPORTED) +set_property(TARGET boost PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) # Enable unit-testing. enable_testing(true) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9915151e..819d3143 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -111,9 +111,7 @@ target_include_directories(dynarmic PRIVATE .) target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS}) -# Link fmt -target_link_libraries(dynarmic PRIVATE fmt-header-only) +target_link_libraries(dynarmic PRIVATE boost fmt-header-only xbyak) if (CMAKE_SYSTEM_NAME STREQUAL "Windows") target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0) endif() -target_link_libraries(dynarmic PRIVATE xbyak) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 84b93fb2..e41a776b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -35,7 +35,7 @@ include(CreateDirectoryGroups) create_directory_groups(${SRCS} ${HEADERS}) add_executable(dynarmic_tests ${SRCS}) -target_link_libraries(dynarmic_tests dynarmic catch ${llvm_libs}) +target_link_libraries(dynarmic_tests PRIVATE dynarmic boost catch ${llvm_libs}) set_target_properties(dynarmic_tests PROPERTIES LINKER_LANGUAGE CXX) target_include_directories(dynarmic_tests PRIVATE . ../src) target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS})