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 <jeffpc@josefsipek.net>
2 files changed, 11 insertions(+), 10 deletions(-)

M daemon/CMakeLists.txt
M rpc/CMakeLists.txt
M daemon/CMakeLists.txt +5 -4
@@ 30,10 30,6 @@ add_executable(hlogd
 	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 @@ target_link_libraries(hlogd
 	hlogrpc
 	pthread
 )
+
+target_link_directories(hlogd
+	PRIVATE
+	"${GPS_LIBRARY_DIRS}"
+)

          
M rpc/CMakeLists.txt +6 -6
@@ 29,12 29,6 @@ add_library(hlogrpc SHARED
 	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 @@ target_link_libraries(hlogrpc
 	hlogcommon
 	m
 )
+
+target_link_directories(hlogrpc
+	PRIVATE
+	"${ZEROMQ_LIBRARY_DIRS}"
+	"${HAMLIB_LIBRARY_DIRS}"
+)