--- a/CMakeLists.txt Sun Dec 29 15:08:52 2013 +0400
+++ b/CMakeLists.txt Sun Dec 29 12:37:05 2013 +0100
@@ -51,9 +51,10 @@
#general utilities
include(${CMAKE_MODULE_PATH}/utils.cmake)
+#paths initialization
+include(${CMAKE_MODULE_PATH}/paths.cmake)
#platform specific init code
include(${CMAKE_MODULE_PATH}/platform.cmake)
-include(${CMAKE_MODULE_PATH}/paths.cmake)
#when build type is not specified, assume Debug/Release according to build version information
--- a/cmake_modules/paths.cmake Sun Dec 29 15:08:52 2013 +0400
+++ b/cmake_modules/paths.cmake Sun Dec 29 12:37:05 2013 +0100
@@ -55,14 +55,16 @@
#which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
-#paths where to find libraries (final slash not optional):
-# - the first is relative to the executable
-# - the second is the same directory of the executable (so it runs in bin/)
-# - the third one is the full path of the system dir
-#source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
-set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
-
-
-#install_name_tool magic for OS X
-set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
-
+if(APPLE)
+ #@rpath mangling
+ set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
+ #install_name_tool for libraries
+ set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
+else(APPLE)
+ #paths where to find libraries (final slash not optional):
+ # - the first is relative to the executable
+ # - the second is the same directory of the executable (so it runs in bin/)
+ # - the third one is the full path of the system dir
+ #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
+ set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
+endif(APPLE)
--- a/cmake_modules/platform.cmake Sun Dec 29 15:08:52 2013 +0400
+++ b/cmake_modules/platform.cmake Sun Dec 29 12:37:05 2013 +0100
@@ -31,24 +31,15 @@
set(minimum_macosx_version ${current_macosx_version})
endif()
- #lower systems don't have enough processing power anyway
- if (minimum_macosx_version VERSION_LESS "10.4")
- message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4")
- endif()
-
- #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
- if(current_macosx_version VERSION_EQUAL "10.4")
- find_package(SDL_mixer REQUIRED)
- set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg")
- set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
- add_flag_append(CMAKE_C_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
- add_flag_append(CMAKE_CXX_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
- add_flag_append(CMAKE_Pascal_FLAGS "-k${DYLIB_SMPEG} -k${DYLIB_MIKMOD}")
+ #10.3 systems don't have enough processing power anyway
+ #10.4 does not have @rpath support (which SDL uses)
+ if(minimum_macosx_version VERSION_LESS "10.5")
+ message(FATAL_ERROR "Hedgewars is not supported on your version of Mac OS X")
endif()
if(NOT CMAKE_OSX_ARCHITECTURES)
if(current_macosx_version VERSION_LESS "10.6")
- #SDL is only 32 bit on lower OS
+ #SDL is only 32 bit on older OS version
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*")
set(CMAKE_OSX_ARCHITECTURES "ppc7400")
else()
@@ -83,20 +74,21 @@
#CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on
#we need to provide the correct one when host and target differ
if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version})
- if(minimum_macosx_version VERSION_EQUAL "10.4")
- set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
- set(CMAKE_C_COMPILER "/Developer/usr/bin/gcc-4.0")
- set(CMAKE_CXX_COMPILER "/Developer/usr/bin/g++-4.0")
- else()
- string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
- set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
- endif()
+ string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
+ set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
add_flag_append(CMAKE_Pascal_FLAGS "-XR${CMAKE_OSX_SYSROOT}")
add_flag_append(CMAKE_Pascal_FLAGS "-k-macosx_version_min -k${minimum_macosx_version}")
endif()
#add user framework directory
add_flag_append(CMAKE_Pascal_FLAGS "-Ff~/Library/Frameworks")
+
+ #workaround older cmake versions
+ if(${CMAKE_VERSION} VERSION_LESS "2.8.12")
+ add_flag_append(CMAKE_C_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
+ add_flag_append(CMAKE_CXX_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
+ add_flag_append(CMAKE_Pascal_LINK_FLAGS "-k-rpath -k${CMAKE_INSTALL_RPATH}")
+ endif()
endif(APPLE)
if(MINGW)