From 092fb9b9cebfd56801e0b2bb5a1c86b07b5d5597 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 11 Dec 2020 12:34:23 +0100 Subject: [PATCH] Potential fix for linker issues. --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0e6465..57f9f49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,15 +128,17 @@ if (NOT WINDOWS) set(_LINKS ${_LINKS} -ldw) endif () -if (STATICC) - message(STATUS "Linking C library statically") - SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread) -endif() - set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -target_link_libraries(pkmnLib PUBLIC ${_LINKS} Threads::Threads) +if (STATICC) + message(STATUS "Linking C library statically") + SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread) +else() + SET(_LINKS ${_LINKS} Threads::Threads) +endif() + +target_link_libraries(pkmnLib PUBLIC ${_LINKS}) if (TESTS) # Create Test executable