# HG changeset patch # User Josef 'Jeff' Sipek # Date 1674873171 18000 # Fri Jan 27 21:32:51 2023 -0500 # Node ID 95dddaa97fa678c0439560423be7aa77ecec85bc # Parent 459e40c54ba660521d6f4d27e0af96ffc3db02e9 build: use target_link_directories instead of mucking with LINK_FLAGS cmake 3.13 introduced target_link_directories which is a much safer way to tell the linker where to search for libraries. Injecting -L${foo} into LINK_FLAGS was not portable and caused weird errors when the path (e.g., ${foo}) was empty. Note that we already require cmake 3.18. Signed-off-by: Josef 'Jeff' Sipek diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -30,10 +30,6 @@ wsjtx.c ) -set_target_properties(hlogd PROPERTIES - LINK_FLAGS "-L${GPS_LIBRARY_DIRS}" -) - target_include_directories(hlogd PRIVATE ${GPS_INCLUDE_DIRS} ) @@ -45,3 +41,8 @@ hlogrpc pthread ) + +target_link_directories(hlogd + PRIVATE + "${GPS_LIBRARY_DIRS}" +) diff --git a/rpc/CMakeLists.txt b/rpc/CMakeLists.txt --- a/rpc/CMakeLists.txt +++ b/rpc/CMakeLists.txt @@ -29,12 +29,6 @@ hamlib.c ) -if(ZEROMQ_LIBRARY_DIRS) - set_target_properties(hlogrpc PROPERTIES - LINK_FLAGS "-L${ZEROMQ_LIBRARY_DIRS} -L${HAMLIB_LIBRARY_DIRS}" - ) -endif() - target_include_directories(hlogrpc PRIVATE ${ZEROMQ_INCLUDE_DIRS} ${HAMLIB_INCLUDE_DIRS} @@ -48,3 +42,9 @@ hlogcommon m ) + +target_link_directories(hlogrpc + PRIVATE + "${ZEROMQ_LIBRARY_DIRS}" + "${HAMLIB_LIBRARY_DIRS}" +)