From badc5ea487803ec1c1044793ee6137c13c21d1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Thu, 3 Aug 2023 14:53:51 +0200 Subject: [PATCH] rt and psapi are now a dependency of the UTILS library. --- src/cmake_modules/FastDownwardMacros.cmake | 15 +++++++++++++++ src/search/CMakeLists.txt | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 49ed865e35..d2bc4b8e31 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -132,6 +132,21 @@ function(create_fast_downward_library) foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() + # TODO: This feels very hacky. I'd rather have the ability to specify + # external dependencies in DownwardFiles.cmake (i.e. new parameter + # DEPENDSEXTERNAL) but how to specify conditions there? + if (${_LIBRARY_NAME} STREQUAL "UTILS") + # On Linux, find the rt library for clock_gettime(). + if(UNIX AND NOT APPLE) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE rt) + endif() + + # On Windows, find the psapi library for determining peak memory. + if(WIN32) + cmake_policy(SET CMP0074 NEW) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE psapi) + endif() + endif() if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME}_ENABLED) target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index ab115adab9..6603cc2073 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -28,20 +28,6 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") ## == Libraries == -# TODO the next two libraries should be dependencies of the (interface) library -# that actually uses the corresponding methods (probably the one containing system.h?). - -# On Linux, find the rt library for clock_gettime(). -if(UNIX AND NOT APPLE) - target_link_libraries(downward PRIVATE rt) -endif() - -# On Windows, find the psapi library for determining peak memory. -if(WIN32) - cmake_policy(SET CMP0074 NEW) - target_link_libraries(downward PRIVATE psapi) -endif() - # If any enabled plugin requires an LP solver, compile with all # available LP solvers. If no solvers are installed, the planner will # still compile, but using heuristics that depend on an LP solver will