Fixed an issue where it was impossible to link against static SFML libs on non Windows platforms

This commit is contained in:
Zachariah Brown authored and Lukas Dürrenberger committed 2018-10-06 20:46:13 +02:00
1 parent 3b41d938f9
commit bff4a69a73
2 files changed
+10 -6

No files matched your search

+7 -1
View File
@@ -34,7 +34,13 @@ csfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libr
csfml_set_option(CSFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
# add an option for linking to sfml either statically or dynamically
csfml_set_option(CSFML_LINK_SFML_STATICALLY TRUE BOOL "TRUE to link to a static version of SFML, FALSE to link dynamically")
# default on windows to static and on other platforms to dynamic
if(SFML_OS_WINDOWS)
set(LINK_STATICALLY_DEFAULT TRUE)
else()
set(LINK_STATICALLY_DEFAULT FALSE)
endif()
csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} BOOL "TRUE to link to a static version of SFML, FALSE to link dynamically")
# disable the rpath stuff
set(CMAKE_SKIP_BUILD_RPATH TRUE)
+3 -5
View File
@@ -17,11 +17,9 @@ if(SFML_COMPILER_MSVC)
endif()
# find SFML libraries (C++)
if(SFML_OS_WINDOWS)
if (CSFML_LINK_SFML_STATICALLY)
set(SFML_STATIC_LIBRARIES TRUE)
add_definitions(-DSFML_STATIC)
endif()
if(CSFML_LINK_SFML_STATICALLY)
set(SFML_STATIC_LIBRARIES TRUE)
add_definitions(-DSFML_STATIC)
endif()
find_package(SFML 2 COMPONENTS network graphics audio REQUIRED)