little cmake cleanup, search installed modules first, then our own
authorkoda
Wed, 21 Nov 2012 12:03:40 +0100
changeset 8087 ccc99eebdac2
parent 8086 576ca9b3c7d8
child 8088 55f99b65e795
little cmake cleanup, search installed modules first, then our own
CMakeLists.txt
hedgewars/CMakeLists.txt
misc/physfs/CMakeLists.txt
--- a/CMakeLists.txt	Wed Nov 21 11:26:30 2012 +0100
+++ b/CMakeLists.txt	Wed Nov 21 12:03:40 2012 +0100
@@ -1,14 +1,13 @@
 project(hedgewars)
 
-
 #initialise cmake environment
 cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
-FOREACH(policy CMP0003 CMP0012)
-    IF(POLICY ${policy})
-        CMAKE_POLICY(SET ${policy} NEW)
-    ENDIF()
+cmake_policy(VERSION 2.6)
+FOREACH(hwpolicy CMP0003 CMP0012 CMP0017)
+    CMAKE_POLICY(SET ${hwpolicy} NEW)
 ENDFOREACH()
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
+#use available modules, fallback to ours if not present (CMP0017 helps)
+set(CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
 
 
 #detect Mercurial revision (if present)
--- a/hedgewars/CMakeLists.txt	Wed Nov 21 11:26:30 2012 +0100
+++ b/hedgewars/CMakeLists.txt	Wed Nov 21 12:03:40 2012 +0100
@@ -4,7 +4,7 @@
 find_package(SDL_ttf)
 find_package(SDL_mixer)
 
-include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake)
+include(${CMAKE_SOURCE_DIR}/cmake_modules/FindSDL_Extras.cmake)
 
 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 
--- a/misc/physfs/CMakeLists.txt	Wed Nov 21 11:26:30 2012 +0100
+++ b/misc/physfs/CMakeLists.txt	Wed Nov 21 12:03:40 2012 +0100
@@ -3,13 +3,9 @@
 #
 # Please see the file LICENSE.txt in the source's root directory.
 
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-
-if(COMMAND cmake_policy)
-  cmake_policy(SET CMP0003 NEW)
-endif(COMMAND cmake_policy)
-    
-PROJECT(PhysicsFS)
+#lines overridden by Hedgewars configuration
+#CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+#PROJECT(PhysicsFS)
 SET(PHYSFS_VERSION 2.1.0)
 
 # Increment this if/when we break backwards compatibility.
@@ -264,9 +260,11 @@
     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ISO9660=1)
 ENDIF(PHYSFS_ARCHIVE_ISO9660)
 
+#as needed by Hedgewars configuration
 IF(WINDOWS)
     OPTION(PHYSFS_BUILD_STATIC "Build static library" FALSE)
     OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
+    SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} ${SDL_LIBRARY})
 ELSE(WINDOWS)
     OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
     OPTION(PHYSFS_BUILD_SHARED "Build shared library" FALSE)
@@ -284,7 +282,7 @@
     ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
     SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
     SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
-    TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS} ${SDL_LIBRARY})
+    TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
     SET(PHYSFS_LIB_TARGET physfs)
     SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
 ENDIF(PHYSFS_BUILD_SHARED)