Skip to content

Commit

Permalink
set path in find_dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Jan 12, 2024
1 parent 71ff671 commit 39970a7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 34 deletions.
23 changes: 20 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ endif()
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/cmake"
)
include("configure_dependencies")
include("configure_boost")
include("configure_ccache")

Expand All @@ -69,8 +68,26 @@ configure_ccache()
# Dependency Handling
##############################################################

# Add lokis dependencies
configure_dependencies()
# We installed the dependencies into the subdirectories under the install prefix.
# Hence must append them to the single cmake_prefix_path.
message("Configure dependencies of Loki:")
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
list(LENGTH CMAKE_PREFIX_PATH PREFIX_PATH_COUNT)
if(PREFIX_PATH_COUNT GREATER 1)
message(FATAL_ERROR "Only one prefix path is allowed. Found multiple paths in CMAKE_PREFIX_PATH. Please add dependencies to the CMake Superbuild.")
endif()

list(APPEND MODIFIED_CMAKE_PREFIX_PATH
"${CMAKE_PREFIX_PATH}/benchmark"
"${CMAKE_PREFIX_PATH}/boost"
"${CMAKE_PREFIX_PATH}/googletest")
message(${MODIFIED_CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${MODIFIED_CMAKE_PREFIX_PATH})
message(STATUS "MODIFIED_CMAKE_PREFIX_PATH:")
foreach(CMAKE_PREFIX_PATH_ARG ${CMAKE_PREFIX_PATH})
message(STATUS "-- ${CMAKE_PREFIX_PATH_ARG}")
endforeach()
# set(CMAKE_FIND_DEBUG_MODE ON)

# Boost
# Find Boost headers only according to https://cmake.org/cmake/help/latest/module/FindBoost.html
Expand Down
10 changes: 3 additions & 7 deletions Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ include(CMakeFindDependencyMacro)
##############################################################

include("${CMAKE_CURRENT_LIST_DIR}/cmake/configure_boost.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/configure_dependencies.cmake")


##############################################################
# Dependency Handling
##############################################################


# Add lokis dependencies
message(STATUS "Calling configure_loki_dependencies macro in ${CMAKE_CURRENT_LIST_DIR}/cmake")
configure_dependencies()

# Boost
# Find Boost headers only according to https://cmake.org/cmake/help/latest/module/FindBoost.html
configure_boost()
find_dependency(Boost ${BOOST_MIN_VERSION} REQUIRED)
find_dependency(Boost ${BOOST_MIN_VERSION} REQUIRED PATHS "${CMAKE_INSTALL_PREFIX}/boost" NO_DEFAULT_PATH)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
Expand Down
22 changes: 0 additions & 22 deletions cmake/configure_dependencies.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions tests/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ project(integration_example VERSION "0.0.1" LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/cmake"
)
include("configure_dependencies")
# include("configure_dependencies")


##############################################################
# Dependency Handling
##############################################################

# Add lokis dependencies
configure_dependencies()
# configure_dependencies()


##############################################################
Expand Down

0 comments on commit 39970a7

Please sign in to comment.