diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cf3c3f7..3b7f5164 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,32 +29,9 @@ option(BOOST_UT_BUILD_TESTS "Build the tests" ${PROJECT_IS_TOP_LEVEL}) option(BOOST_UT_ENABLE_INSTALL "Enable install targets" ${PROJECT_IS_TOP_LEVEL}) option(BOOST_UT_USE_WARNINGS_AS_ERORS "Build the tests" ${PROJECT_IS_TOP_LEVEL}) option(BOOST_UT_DISABLE_MODULE "Disable ut module" OFF) -option(BOOST_UT_ALLOW_CPM_USE "Do not reach out across network for CPM" ON) - -if(BOOST_UT_ENABLE_INSTALL AND NOT CMAKE_SKIP_INSTALL_RULES) - if(BOOST_UT_ALLOW_CPM_USE) - # ---- Add dependencies via CPM ---- - # see https://github.com/cpm-cmake/CPM.cmake for more info - - include(cmake/CPM.cmake) - - # PackageProject.cmake will be used to make our target installable - CPMAddPackage( - NAME PackageProject.cmake - GITHUB_REPOSITORY TheLartians/PackageProject.cmake - VERSION 1.10.0 - ) - else() - include(cmake/PackageProject.cmake) - endif() -endif() add_library(ut INTERFACE) -if(BOOST_UT_ALLOW_CPM_USE) -add_library(Boost::ut ALIAS ut) -endif() - if(NOT DEFINED INCLUDE_INSTALL_DIR) set(INCLUDE_INSTALL_DIR include/${PROJECT_NAME}-${PROJECT_VERSION}/include) endif() @@ -85,6 +62,7 @@ if(BOOST_UT_DISABLE_MODULE) endif() if(BOOST_UT_ENABLE_INSTALL AND NOT CMAKE_SKIP_INSTALL_RULES) + include(cmake/PackageProject.cmake) # Create target Boost::ut and install target packageProject( NAME ${PROJECT_NAME} @@ -99,6 +77,10 @@ if(BOOST_UT_ENABLE_INSTALL AND NOT CMAKE_SKIP_INSTALL_RULES) ) endif() +if(NOT TARGET Boost::ut) + add_library(Boost::ut ALIAS ut) +endif() + if (EMSCRIPTEN) set(CMAKE_EXECUTABLE_SUFFIX ".js") target_link_options(ut INTERFACE diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake deleted file mode 100644 index 772103fc..00000000 --- a/cmake/CPM.cmake +++ /dev/null @@ -1,21 +0,0 @@ -set(CPM_DOWNLOAD_VERSION 0.36.0) - -if(CPM_SOURCE_CACHE) - set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") -elseif(DEFINED ENV{CPM_SOURCE_CACHE}) - set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") -else() - set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") -endif() - -# Expand relative path. This is important if the provided path contains a tilde (~) -get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) -if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) - message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") - file(DOWNLOAD - https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake - ${CPM_DOWNLOAD_LOCATION} - ) -endif() - -include(${CPM_DOWNLOAD_LOCATION})