From f310554adcb5f5be74de7bf6fa7c26a4bd1a9ee5 Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Fri, 13 Nov 2020 14:37:55 +0300 Subject: [PATCH] Be more explicit about build-tree-only dependencies. Use the BUILD_INTERFACE CMake generator expression to improve self-documentation and to prevent build-tree-only dependencies from propagating to exported targets. When libgromacs is a STATIC target, even private dependencies can affect the exported target through transitive usage requirements (e.g. compiler/linker flags). However, we currently only use the `common` and `legacy_modules` targets for build time header paths. Ref #3288 --- src/gromacs/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gromacs/CMakeLists.txt b/src/gromacs/CMakeLists.txt index 97aca444db..65bf17387a 100644 --- a/src/gromacs/CMakeLists.txt +++ b/src/gromacs/CMakeLists.txt @@ -186,13 +186,13 @@ if (GMX_GPU_CUDA) else() add_library(libgromacs ${LIBGROMACS_SOURCES}) endif() -target_link_libraries(libgromacs PRIVATE common) +target_link_libraries(libgromacs PRIVATE $) # As long as the libgromacs target has source files that reference headers from # modules that don't provide CMake targets, libgromacs needs to use `src/` # amongst its include directories (to support `#include "gromacs/module/header.h"`). add_library(legacy_modules INTERFACE) -target_include_directories(legacy_modules INTERFACE ${CMAKE_SOURCE_DIR}/src) -target_link_libraries(libgromacs PRIVATE legacy_modules) +target_include_directories(legacy_modules INTERFACE $) +target_link_libraries(libgromacs PRIVATE $) # Add these contents first because linking their tests can take a lot # of time, so we want lots of parallel work still available after -- 2.22.0