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.
This commit is contained in:
Lioncash 2017-03-03 22:09:28 -05:00 committed by Merry
parent 6396bd02f0
commit 9906be746f
5 changed files with 7 additions and 8 deletions

View file

@ -18,7 +18,7 @@ install:
before_build: before_build:
- mkdir build - mkdir build
- cd 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 .. - cd ..
build: build:

View file

@ -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 export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
mkdir build && cd build 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 make -j4
ctest -VV -C Release ctest -VV -C Release
@ -21,6 +21,6 @@ elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
export MACOSX_DEPLOYMENT_TARGET=10.9 export MACOSX_DEPLOYMENT_TARGET=10.9
mkdir build && cd build 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 xcodebuild -configuration Release
fi fi

View file

@ -109,7 +109,8 @@ else()
message(FATAL_ERROR "Please provide a path to a boost installation using Boost_INCLUDE_DIRS") message(FATAL_ERROR "Please provide a path to a boost installation using Boost_INCLUDE_DIRS")
endif() endif()
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 unit-testing.
enable_testing(true) enable_testing(true)

View file

@ -111,9 +111,7 @@ target_include_directories(dynarmic
PRIVATE .) PRIVATE .)
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS}) target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
# Link fmt target_link_libraries(dynarmic PRIVATE boost fmt-header-only xbyak)
target_link_libraries(dynarmic PRIVATE fmt-header-only)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows") if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0) target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
endif() endif()
target_link_libraries(dynarmic PRIVATE xbyak)

View file

@ -35,7 +35,7 @@ include(CreateDirectoryGroups)
create_directory_groups(${SRCS} ${HEADERS}) create_directory_groups(${SRCS} ${HEADERS})
add_executable(dynarmic_tests ${SRCS}) 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) set_target_properties(dynarmic_tests PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(dynarmic_tests PRIVATE . ../src) target_include_directories(dynarmic_tests PRIVATE . ../src)
target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS}) target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS})