Merge pull request #218 from BMBurstein/master

fix for static builds with mingw-w64 compilers
This commit is contained in:
Laurent Gomila 2013-02-17 08:28:12 -08:00
commit 274d316891
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,3 @@
# detect the OS
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS 1)
@ -47,6 +46,11 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
set(COMPILER_GCC 1)
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" GCC_VERSION "${GCC_VERSION_OUTPUT}")
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE)
string(STRIP "${GCC_MACHINE}" GCC_MACHINE)
if(${GCC_MACHINE} MATCHES ".*w64.*")
set(COMPILER_GCC_W64 1)
endif()
elseif(MSVC)
set(COMPILER_MSVC 1)
if(MSVC_VERSION EQUAL 1400)

View File

@ -1,4 +1,3 @@
# some of these macros are inspired from the boost/cmake macros
# this macro adds external dependencies to a static target,
@ -16,8 +15,12 @@ macro(sfml_static_add_libraries target)
foreach(lib ${ARGN})
if(NOT ${lib} MATCHES ".*/.*")
string(REGEX REPLACE "(.*)/bin/.*\\.exe" "\\1" STANDARD_LIBS_PATH "${CMAKE_CXX_COMPILER}")
if(COMPILER_GCC_W64)
set(lib "${STANDARD_LIBS_PATH}/${GCC_MACHINE}/lib/lib${lib}.a")
else()
set(lib "${STANDARD_LIBS_PATH}/lib/lib${lib}.a")
endif()
endif()
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
get_target_property(TARGET_FILENAME ${target} ${BUILD_TYPE}_LOCATION)
add_custom_command(TARGET ${target}