Skip to content

Commit

Permalink
Merge pr #21: simplify cmake exports
Browse files Browse the repository at this point in the history
Simplify cmake
  • Loading branch information
mikucionisaau authored Sep 11, 2023
2 parents fb35a45 + 53558dc commit 342c401
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0048 NEW) # project() command manages VERSION variables
project(UUtils VERSION 2.0.1 HOMEPAGE_URL "https://github.com/UPPAALModelChecker/UUtils" LANGUAGES CXX C)
project(UUtils VERSION 2.0.2 HOMEPAGE_URL "https://github.com/UPPAALModelChecker/UUtils" LANGUAGES CXX C)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(FetchContent)
Expand Down
2 changes: 1 addition & 1 deletion cmake/benchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (benchmark_FOUND)
else(benchmark_FOUND)
message(STATUS "Failed to find benchmark, going to compile from source.")
if (FIND_FATAL)
message(FATAL_ERROR "Failed to find with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
message(FATAL_ERROR "Failed to find benchmark with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
endif(FIND_FATAL)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Enable tests")
set(BENCHMARK_ENABLE_EXCEPTIONS ON CACHE BOOL "Enable the use of exceptions in the benchmark library. Default ON")
Expand Down
2 changes: 1 addition & 1 deletion cmake/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (Boost_FOUND)
else(Boost_FOUND)
message(STATUS "Failed to find Boost (${BOOST_INCLUDE_LIBRARIES}), going to compile from source")
if (FIND_FATAL)
message(FATAL_ERROR "Failed to find with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
message(FATAL_ERROR "Failed to find Boost with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
endif(FIND_FATAL)
set(BOOST_ENABLE_CMAKE ON)
FetchContent_Declare(
Expand Down
2 changes: 1 addition & 1 deletion cmake/doctest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (doctest_FOUND)
else(doctest_FOUND)
message(STATUS "Failed to find doctest, going to compile from source.")
if (FIND_FATAL)
message(FATAL_ERROR "Failed to find ${FIND_FATAL} with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
message(FATAL_ERROR "Failed to find doctest with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
endif(FIND_FATAL)
set(DOCTEST_WITH_TESTS OFF CACHE BOOL "doctest tests and examples")
set(DOCTEST_WITH_MAIN_IN_STATIC_LIB ON CACHE BOOL "static lib (cmake target) with a default main entry point")
Expand Down
2 changes: 1 addition & 1 deletion cmake/xxhash.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (xxHash_FOUND)
else(xxHash_FOUND)
message(STATUS "Failed to find xxHash, going to compile from source.")
if (FIND_FATAL)
message(FATAL_ERROR "Failed to find with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
message(FATAL_ERROR "Failed to find xxHash with CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
endif(FIND_FATAL)
include(ExternalProject)
set(XXHASH_BUILD_ENABLE_INLINE_API ON CACHE BOOL "adds xxhash.c for the -DXXH_INLINE_ALL api. Default ON")
Expand Down
11 changes: 4 additions & 7 deletions src/base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
add_library(random OBJECT random.cpp)
target_link_libraries(random PRIVATE Boost::headers Boost::math)

add_library(base STATIC bitstring.c c_allocator.c doubles.c platform.c DataAllocator.cpp Enumerator.cpp exceptions.cpp
intutils.cpp property.cpp stats.cpp Timer.cpp)
intutils.cpp property.cpp stats.cpp Timer.cpp random.cpp)

if (CMAKE_SYSTEM_NAME STREQUAL Windows)
target_link_libraries(base PUBLIC hash PRIVATE udebug random xxHash Boost::headers iphlpapi psapi)
target_link_libraries(base PUBLIC hash PRIVATE udebug xxHash Boost::headers Boost::math iphlpapi psapi)
else()
target_link_libraries(base PUBLIC hash PRIVATE udebug random xxHash Boost::headers)
target_link_libraries(base PUBLIC hash PRIVATE udebug xxHash Boost::headers Boost::math)
endif()

target_include_directories(base
Expand All @@ -16,5 +13,5 @@ target_include_directories(base
$<INSTALL_INTERFACE:include>
)

install(TARGETS base random EXPORT UUtilsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT base)
install(TARGETS base EXPORT UUtilsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT base)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../include/base DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT base)

0 comments on commit 342c401

Please sign in to comment.