Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.13)
set(MEMILIO_CMAKE_MINIMUM_VERSION "3.18.0")
cmake_minimum_required(VERSION ${MEMILIO_CMAKE_MINIMUM_VERSION})

project(memilio VERSION 1.0.0)

Expand Down
11 changes: 3 additions & 8 deletions cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,13 @@ set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Don't install benchmark" FORCE)
set(BENCHMARK_DOWNLOAD_DEPENDENCIES OFF CACHE BOOL "Don't download dependencies" FORCE)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable Google Test in benchmark" FORCE)

message(STATUS "Downloading GoogleBenchmark library")
include(FetchContent)
FetchContent_Declare(benchmark
SOURCE_SUBDIR this_directory_name_does_not_exist
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.6.1)
FetchContent_GetProperties(benchmark)

if(NOT benchmark_POPULATED)
FetchContent_Populate(benchmark)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "")
add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR} EXCLUDE_FROM_ALL)
unset(CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
endif()
FetchContent_MakeAvailable(benchmark)

set_target_properties(benchmark PROPERTIES FOLDER "Extern")

Expand Down
17 changes: 0 additions & 17 deletions cpp/cmake/DownloadProject.CMakeLists.cmake.in

This file was deleted.

164 changes: 0 additions & 164 deletions cpp/cmake/DownloadProject.cmake

This file was deleted.

11 changes: 0 additions & 11 deletions cpp/cmake/FindSphinx.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cpp/memilio/ad/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.5...${MEMILIO_CMAKE_MINIMUM_VERSION})
project(AD CXX)

add_library(AD INTERFACE)
Expand Down
65 changes: 12 additions & 53 deletions cpp/tests/cmake/AddGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,12 @@
#
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

if(CMAKE_VERSION VERSION_LESS 3.11)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")

include(DownloadProject)
download_project(PROJ googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.16.0
UPDATE_DISCONNECTED 1
QUIET
)

# CMake warning suppression will not be needed in version 1.9
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "")
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_SOURCE_DIR} EXCLUDE_FROM_ALL)
unset(CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
else()
include(FetchContent)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.16.0)
FetchContent_GetProperties(googletest)

if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "")
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
unset(CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
endif()
endif()
message(STATUS "Downloading GoogleTest library")
include(FetchContent)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.16.0)
FetchContent_MakeAvailable(googletest)

if(CMAKE_CONFIGURATION_TYPES)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
Expand All @@ -47,34 +24,16 @@ endif()

set_target_properties(check PROPERTIES FOLDER "Scripts")

# include_directories(${gtest_SOURCE_DIR}/include)

# More modern way to do the last line, less messy but needs newish CMake:
# target_include_directories(gtest INTERFACE ${gtest_SOURCE_DIR}/include)
if(GOOGLE_TEST_INDIVIDUAL)
if(NOT CMAKE_VERSION VERSION_LESS 3.9)
include(GoogleTest)
else()
set(GOOGLE_TEST_INDIVIDUAL OFF)
endif()
endif()

# Target must already exist
macro(add_gtest TESTNAME)
target_link_libraries(${TESTNAME} PUBLIC gtest gmock gtest_main)

if(GOOGLE_TEST_INDIVIDUAL)
if(CMAKE_VERSION VERSION_LESS 3.10)
gtest_add_tests(TARGET ${TESTNAME}
TEST_PREFIX "${TESTNAME}."
TEST_LIST TmpTestList)
set_tests_properties(${TmpTestList} PROPERTIES FOLDER "Tests")
else()
gtest_discover_tests(${TESTNAME}
TEST_PREFIX "${TESTNAME}."
PROPERTIES FOLDER "Tests"
DISCOVERY_TIMEOUT 30)
endif()
if(GOOGLE_TEST_INDIVIDUAL)
include(GoogleTest)
gtest_discover_tests(${TESTNAME}
TEST_PREFIX "${TESTNAME}."
PROPERTIES FOLDER "Tests"
DISCOVERY_TIMEOUT 30)
else()
add_test(${TESTNAME} ${TESTNAME})
set_target_properties(${TESTNAME} PROPERTIES FOLDER "Tests")
Expand Down
17 changes: 0 additions & 17 deletions cpp/tests/cmake/DownloadProject.CMakeLists.cmake.in

This file was deleted.

Loading
Loading