mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 14:21:04 +08:00
Added missing SFML_USE_STATIC_STD_LIBS checks to CMake configuration.
This commit is contained in:
parent
5d0996906b
commit
8c9c5c5b99
@ -20,12 +20,18 @@ endmacro()
|
||||
# example: sfml_set_stdlib(sfml-system)
|
||||
function(sfml_set_stdlib target)
|
||||
# for gcc on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
||||
if(SFML_OS_WINDOWS)
|
||||
if(SFML_COMPILER_GCC)
|
||||
if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
||||
target_link_libraries(${target} PRIVATE "-static-libgcc" "-static-libstdc++")
|
||||
elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
||||
target_link_libraries(${target} PRIVATE "-shared-libgcc" "-shared-libstdc++")
|
||||
endif()
|
||||
elseif(SFML_COMPILER_MSVC)
|
||||
if(SFML_USE_STATIC_STD_LIBS)
|
||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -134,10 +140,6 @@ macro(sfml_add_library module)
|
||||
set_target_properties(${target} PROPERTIES RELEASE_POSTFIX -s)
|
||||
set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
|
||||
set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
|
||||
|
||||
if(SFML_USE_STATIC_STD_LIBS)
|
||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
||||
@ -289,10 +291,6 @@ macro(sfml_add_example target)
|
||||
add_executable(${target} ${target_input})
|
||||
endif()
|
||||
|
||||
if(SFML_USE_STATIC_STD_LIBS)
|
||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
|
||||
# enable precompiled headers
|
||||
if (SFML_ENABLE_PCH)
|
||||
message(VERBOSE "enabling PCH for SFML example '${target}'")
|
||||
@ -349,6 +347,9 @@ function(sfml_add_test target SOURCES DEPENDS)
|
||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||
set_target_properties(${target} PROPERTIES FOLDER "Tests")
|
||||
|
||||
# set the target flags to use the appropriate C++ standard library
|
||||
sfml_set_stdlib(${target})
|
||||
|
||||
# link the target to its SFML dependencies
|
||||
target_link_libraries(${target} PRIVATE ${DEPENDS} sfml-test-main)
|
||||
|
||||
|
@ -33,6 +33,11 @@ target_include_directories(sfml-test-main PUBLIC TestUtilities)
|
||||
target_link_libraries(sfml-test-main PUBLIC SFML::System Catch2::Catch2WithMain)
|
||||
set_target_warnings(sfml-test-main)
|
||||
|
||||
# set the target flags to use the appropriate C++ standard library
|
||||
sfml_set_stdlib(Catch2)
|
||||
sfml_set_stdlib(Catch2WithMain)
|
||||
sfml_set_stdlib(sfml-test-main)
|
||||
|
||||
sfml_set_option(SFML_RUN_DISPLAY_TESTS ON BOOL "TRUE to run tests that require a display, FALSE to ignore it")
|
||||
if(SFML_RUN_DISPLAY_TESTS)
|
||||
target_compile_definitions(sfml-test-main PRIVATE SFML_RUN_DISPLAY_TESTS)
|
||||
|
@ -18,3 +18,7 @@ endif()
|
||||
|
||||
add_executable(test-sfml-install Install.cpp)
|
||||
target_link_libraries(test-sfml-install PRIVATE SFML::Graphics SFML::Network SFML::Audio)
|
||||
|
||||
if(SFML_USE_STATIC_STD_LIBS)
|
||||
set_target_properties(test-sfml-install PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user