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