From 53a325c3b40616bcbe76990f5b3dfd94e78b87cd Mon Sep 17 00:00:00 2001 From: raptor <buckyballreaction@gmail.com> Date: Thu, 22 Oct 2020 21:13:12 -0600 Subject: [PATCH] Weird fix to dependencies when detected on the system. I think this is letting CMake automatically link them instead of forcing to the in-tree library dependency name --- master/CMakeLists.txt | 6 +++++- zap/bitfighter_client.cmake | 22 ++++++++++++++++++---- zap/bitfighterd.cmake | 16 +++++++++++++--- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/master/CMakeLists.txt b/master/CMakeLists.txt index 28303fa1b..7dd298842 100644 --- a/master/CMakeLists.txt +++ b/master/CMakeLists.txt @@ -41,7 +41,11 @@ else() endif() -set(MASTER_DEPS tnl tomcrypt) +set(MASTER_DEPS tnl) +# Add tomcypt if not already found on system +if(NOT TOMCRYPT_FOUND) + list(APPEND MASTER_DEPS tomcrypt) +endif() set(MASTER_LIBS tnl diff --git a/zap/bitfighter_client.cmake b/zap/bitfighter_client.cmake index 5dcbd3c9d..ebd166b2d 100644 --- a/zap/bitfighter_client.cmake +++ b/zap/bitfighter_client.cmake @@ -11,13 +11,27 @@ add_library(bitfighter_client OBJECT ${OTHER_HEADERS} ) + +# If certain system libs were not found, add the in-tree variants as dependencies +set(CLIENT_EXTRA_DEPS "") +if(NOT ALURE_FOUND) + list(APPEND CLIENT_EXTRA_DEPS alure) +endif() +if(NOT TOMCRYPT_FOUND) + list(APPEND CLIENT_EXTRA_DEPS tomcrypt) +endif() +if(NOT CLIPPER_FOUND) + list(APPEND CLIENT_EXTRA_DEPS clipper) +endif() +if(NOT POLY2TRI_FOUND) + list(APPEND CLIENT_EXTRA_DEPS poly2tri) +endif() + + add_dependencies(bitfighter_client - alure ${LUA_LIB} tnl - tomcrypt - clipper - poly2tri + ${CLIENT_EXTRA_DEPS} ) if(USE_GLES) diff --git a/zap/bitfighterd.cmake b/zap/bitfighterd.cmake index 3363a7b42..987d7fec6 100644 --- a/zap/bitfighterd.cmake +++ b/zap/bitfighterd.cmake @@ -8,12 +8,22 @@ add_executable(bitfighterd main.cpp ) +# If certain system libs were not found, add the in-tree variants as dependencies +set(DEDICATED_EXTRA_DEPS "") +if(NOT TOMCRYPT_FOUND) + list(APPEND DEDICATED_EXTRA_DEPS tomcrypt) +endif() +if(NOT CLIPPER_FOUND) + list(APPEND DEDICATED_EXTRA_DEPS clipper) +endif() +if(NOT POLY2TRI_FOUND) + list(APPEND DEDICATED_EXTRA_DEPS poly2tri) +endif() + add_dependencies(bitfighterd tnl ${LUA_LIB} - tomcrypt - clipper - poly2tri + ${DEDICATED_EXTRA_DEPS} ) target_link_libraries(bitfighterd -- 2.26.2