moar cmake cleanup, use message(WARNING ...) where appropriate
authorkoda
Wed, 21 Nov 2012 23:34:54 +0100
changeset 8093 2286a39140da
parent 8091 e0a76056a633
child 8095 df61e150eb70
child 8096 453917e94e55
moar cmake cleanup, use message(WARNING ...) where appropriate
CMakeLists.txt
hedgewars/CMakeLists.txt
share/CMakeLists.txt
--- a/CMakeLists.txt	Thu Nov 22 00:56:36 2012 +0400
+++ b/CMakeLists.txt	Wed Nov 21 23:34:54 2012 +0100
@@ -44,7 +44,7 @@
 
         MESSAGE(STATUS "Building revision ${revision_number} from hash ${revision_hash} ${HGCHANGED}")
         IF(HGCHANGED)
-            MESSAGE(WARNING "You have uncommitted changes")
+            MESSAGE(WARNING "Notice: you have uncommitted changes in your repository")
         ENDIF()
         set(version_suffix "-${revision_number}${HGCHANGED}")
     ENDIF()
@@ -85,12 +85,15 @@
     #detect on which system we are: if sw_vers cannot be found for any reason (re)use minimum_macosx_version
     find_program(sw_vers sw_vers)
     if(sw_vers)
-        execute_process(COMMAND ${sw_vers} "-productVersion" OUTPUT_VARIABLE current_macosx_version)
+        execute_process(COMMAND ${sw_vers} "-productVersion"
+                        OUTPUT_VARIABLE current_macosx_version
+                        OUTPUT_STRIP_TRAILING_WHITESPACE)
         string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" current_macosx_version ${current_macosx_version})
-        else()
+    else()
         if(NOT minimum_macosx_version)
             message(FATAL_ERROR "sw_vers not found! Need explicit MACOSX_DEPLOYMENT_TARGET variable set")
         else()
+            message(WARNING "sw_vers not found! Fallback to MACOSX_DEPLOYMENT_TARGET variable")
             set(current_macosx_version ${minimum_macosx_version})
         endif()
     endif()
@@ -100,7 +103,7 @@
         set(minimum_macosx_version ${current_macosx_version})
     endif()
 
-    #lower systems don't have enough processing power anyways
+    #lower systems don't have enough processing power anyway
     if (minimum_macosx_version LESS "10.4")
         message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4")
     endif()
@@ -145,8 +148,8 @@
     #set deployment target
     set(pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_flags})
 
-    message(STATUS "Build system: Mac OS X ${current_macosx_version} with GCC:${CMAKE_C_COMPILER}")
-    message(STATUS "Target system: Mac OS X ${minimum_macosx_version} for architecture(s):${CMAKE_OSX_ARCHITECTURES}")
+    message(STATUS "Build system: Mac OS X ${current_macosx_version} with C compiler: ${CMAKE_C_COMPILER}")
+    message(STATUS "Target system: Mac OS X ${minimum_macosx_version} for architecture(s): ${CMAKE_OSX_ARCHITECTURES}")
 endif(APPLE)
 
 
@@ -230,7 +233,7 @@
         add_subdirectory(gameServer)
         message(STATUS "Found GHC: ${ghc_executable}")
     else()
-        message(STATUS "Could NOT find GHC, server will not be built")
+        message(WARNING "Could NOT find GHC, server will not be built")
         set(HAVE_NETSERVER false)
     endif()
 else()
@@ -246,7 +249,7 @@
 else()
     message(STATUS "LUA will be provided by the bundled sources")
     add_subdirectory(misc/liblua)
-    #linking with liblua.a requires system readline -- this works everywhere, right?
+    #linking with liblua.a requires system readline
     set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags})
 endif()
 
@@ -254,10 +257,10 @@
 #main engine
 add_subdirectory(hedgewars)
 
-# physfs library
+#physfs library
 add_subdirectory(misc/physfs)
 
-# frontend library
+#frontend library
 add_subdirectory(project_files/frontlib)
 
 #Android related build scripts
--- a/hedgewars/CMakeLists.txt	Thu Nov 22 00:56:36 2012 +0400
+++ b/hedgewars/CMakeLists.txt	Wed Nov 21 23:34:54 2012 +0100
@@ -108,9 +108,13 @@
     find_program(fpc_executable fpc)
 ENDIF()
 
-if(fpc_executable)
-    execute_process(COMMAND ${fpc_executable} -iV OUTPUT_VARIABLE fpc_output)
-endif(fpc_executable)
+message(STATUS "Check for working FPC compiler: ${fpc_executable}")
+execute_process(COMMAND ${fpc_executable} -iV OUTPUT_VARIABLE fpc_output ERROR_VARIABLE fpc_error)
+if(fpc_error)
+    message(STATUS "Check for working FPC compiler: ${fpc_executable} -- broken")
+else(fpc_error)
+    message(STATUS "Check for working FPC compiler: ${fpc_executable} -- works")
+endif(fpc_error)
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
 if(fpc_version)
@@ -129,17 +133,21 @@
     message(FATAL_ERROR "No FreePascal compiler found!")
 endif()
 
+message(STATUS "Checking whether linker supports noexecstack flag")
 set(noexecstack_flags "-k-z" "-knoexecstack")
 file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.")
 
 execute_process(COMMAND ${fpc_executable} ${noexecstack_flags} checkstack.pas
     WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
     RESULT_VARIABLE testnoexecstack
-    OUTPUT_QUIET
+    OUTPUT_QUIET ERROR_QUIET
     )
 
 if(${testnoexecstack})
     set (noexecstack_flags "")
+    message(STATUS "Checking whether linker supports noexecstack flag -- no")
+else(${testnoexecstack})
+    message(STATUS "Checking whether linker supports noexecstack flag -- yes")
 endif(${testnoexecstack})
 
 #DEPENDECIES AND EXECUTABLES SECTION
@@ -182,14 +190,13 @@
             set(pascal_flags "-k${PNG_LIBRARY}" ${pascal_flags})
         endif()
     else()
-        message(STATUS "Screenshots will be in BMP format because libpng was not found")
+        message(WARNING "Screenshots will be in BMP format because libpng was not found")
     endif()
 else()
     message(STATUS "Screenshots will be in BMP format per user request")
 endif()
 
 
-
 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
 if(fpc_version LESS "020600")
     #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
@@ -224,7 +231,7 @@
             set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags})
         ENDIF()
     else()
-        message(STATUS "Could NOT find FFMPEG/LibAV, video recording will be disabled")
+        message(WARNING "Could NOT find FFMPEG/LibAV, video recording will be disabled")
     endif()
 else()
     message(STATUS "Video recording disabled by user")
--- a/share/CMakeLists.txt	Thu Nov 22 00:56:36 2012 +0400
+++ b/share/CMakeLists.txt	Wed Nov 21 23:34:54 2012 +0100
@@ -1,28 +1,23 @@
 add_subdirectory(hedgewars)
 
 IF(APPLE OR CROSSAPPLE)
-	#needed for CFBundleVersion and CFBundleShortVersionString
-	FIND_PROGRAM(HGCOMMAND hg)
-	IF (HGCOMMAND AND (EXISTS ${hedgewars_SOURCE_DIR}/.hg))
-            execute_process(COMMAND ${HGCOMMAND} identify -in
-                            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-                            OUTPUT_VARIABLE internal_version
-                            ERROR_QUIET
-                        )
-		STRING(REGEX REPLACE "([0-9]+)(.*)" "\\1" revision_number ${internal_version})
-		set (HEDGEWARS_REVISION ${revision_number})
-	ELSE ()
-		set (HEDGEWARS_REVISION ${HEDGEWARS_VERSION})
-	ENDIF ()
+    #needed for CFBundleVersion and CFBundleShortVersionString
+        #should reuse the variables set in main CMakeLists.txt
+    IF(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg))
+        set(HEDGEWARS_REVISION ${revision_number})
+    ELSE()
+        set(HEDGEWARS_REVISION ${HEDGEWARS_VERSION})
+    ENDIF()
 
-	configure_file(${hedgewars_SOURCE_DIR}/share/Info.plist.in 
-		${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
-	install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/Info.plist"
-		DESTINATION ../)
-	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/Icon.icns"
-		DESTINATION ../Resources/)
-	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/hwico.icns"
-		DESTINATION ../Resources/)
-	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/dsa_pub.pem"
-		DESTINATION ../Resources/)
+    configure_file(${hedgewars_SOURCE_DIR}/share/Info.plist.in
+                   ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
+    #path here should be Hedgewars.app/Contents/MacOS
+    install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/Info.plist"
+            DESTINATION ../)
+    install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/Icon.icns"
+            DESTINATION ../Resources/)
+    install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/hwico.icns"
+            DESTINATION ../Resources/)
+    install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/dsa_pub.pem"
+            DESTINATION ../Resources/)
 ENDIF(APPLE OR CROSSAPPLE)