use cmake OPTION for arguments and further cleanup on CMakeFiles
authorkoda
Fri, 28 Sep 2012 18:03:32 +0100
changeset 7718 97ba379164ec
parent 7717 2684fdb9d874
child 7719 eeae1cb6b6bf
use cmake OPTION for arguments and further cleanup on CMakeFiles
CMakeLists.txt
QTfrontend/CMakeLists.txt
hedgewars/CMakeLists.txt
misc/liblua/CMakeLists.txt
--- a/CMakeLists.txt	Thu Sep 27 13:37:10 2012 -0400
+++ b/CMakeLists.txt	Fri Sep 28 18:03:32 2012 +0100
@@ -48,11 +48,15 @@
 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 
 
-#set some safe values
-IF(NOT BUILD_ENGINE_LIBRARY)
-    SET(BUILD_ENGINE_LIBRARY 0)
-ENDIF(NOT BUILD_ENGINE_LIBRARY)
-set(target_dir "bin")
+#set some default values
+option(NOSERVER "Disable gameServer build [default: auto]" OFF)
+option(NOPNG "Disable screenshoot compression [default: auto]" OFF)
+option(NOVIDEOREC "Disable video recording [default: auto]" OFF)
+
+option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF)
+option(ANDROID "Enable Android build [default: off]" OFF)
+option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF)
+
 
 #bundle .app setup
 if(APPLE OR CROSSAPPLE)
@@ -63,6 +67,8 @@
     set(DATA_INSTALL_DIR "../Resources/")
     set(target_dir ".")
     set(minimum_macosx_version "10.6")
+else()
+    set(target_dir "bin")
 endif()
 
 if(APPLE)
@@ -193,6 +199,7 @@
     set(SHAREPATH share/hedgewars/)
 endif()
 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
 
 
 #server discovery
@@ -206,8 +213,9 @@
     if(ghc_executable)
         set(HAVE_NETSERVER true)
         add_subdirectory(gameServer)
+        message(STATUS "Found GHC: ${ghc_executable}")
     else()
-        message(STATUS "No GHC executable found, server will not be built")
+        message(STATUS "Could NOT find GHC, server will not be built")
         set(HAVE_NETSERVER false)
     endif()
 else()
@@ -219,9 +227,9 @@
 #lua discovery
 find_package(Lua)
 if(LUA_FOUND)
-    message(STATUS "Lua library is present on your system (${LUA_DEFAULT})")
+    message(STATUS "LUA found: ${LUA_DEFAULT}")
 else()
-    message(STATUS "Lua library not found, building bundled dependency")
+    message(STATUS "Cound NOT find LUA, building bundled dependency")
     add_subdirectory(misc/liblua)
     #linking with liblua.a requires system readline -- this works everywhere, right?
     set(pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline" ${pascal_flags})
--- a/QTfrontend/CMakeLists.txt	Thu Sep 27 13:37:10 2012 -0400
+++ b/QTfrontend/CMakeLists.txt	Fri Sep 28 18:03:32 2012 +0100
@@ -51,7 +51,7 @@
 if(WIN32 AND NOT UNIX)
     set(HEDGEWARS_BINDIR ".")
     set(HEDGEWARS_DATADIR "../share/")
-        add_definitions(-DUSE_XFIRE)
+    add_definitions(-DUSE_XFIRE)
 else()
     set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
     if(DEFINED DATA_INSTALL_DIR)
@@ -73,7 +73,7 @@
 file(GLOB_RECURSE UIcpp ui/*.cpp)
 file(GLOB UtilCpp util/*.cpp)
 
-if((NOT NO_VIDEOREC) AND "${FFMPEG_FOUND}")
+if((NOT NOVIDEOREC) AND "${FFMPEG_FOUND}")
     add_definitions(-DVIDEOREC)
 endif()
 
--- a/hedgewars/CMakeLists.txt	Thu Sep 27 13:37:10 2012 -0400
+++ b/hedgewars/CMakeLists.txt	Fri Sep 28 18:03:32 2012 +0100
@@ -137,7 +137,6 @@
         find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_dir}/Resources/)
 
         if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND")
-            set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
             include_directories(${SDL_INCLUDE_DIR})
             add_library (SDLmain STATIC SDLMain.m)
             #add a dependency to the hwengine target
@@ -174,17 +173,17 @@
 if(NOT NOPNG)
     find_package(PNG)
     if(${PNG_FOUND})
-        message(STATUS "PNG screenshots enabled (library found at ${PNG_LIBRARY})")
+        message(STATUS "Found libpng: ${PNG_LIBRARY}")
         set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags})
         if(APPLE)  # need to explictly link with the static lib -- maybe windows too?
             string(REGEX REPLACE "(.*)libpng.*" "\\1" PNG_LIBDIR "${PNG_LIBRARY}")
             set(pascal_flags "-k${PNG_LIBDIR}/libpng.a" ${pascal_flags})
         endif()
     else()
-        message(STATUS "PNG library not found, switching to screenshots in BMP format")
+        message(STATUS "Screenshots will be in BMP format because libpng was not found")
     endif()
 else()
-    message(STATUS "PNG screenshots disabled per user request, using BMP format")
+    message(STATUS "Screenshots will be in BMP format per user request")
 endif()
 
 
@@ -195,12 +194,11 @@
 endif()
 
 
-if(NOT NO_VIDEOREC)
+if(NOT NOVIDEOREC)
     if(${FFMPEG_FOUND})
-        message(STATUS "Compiling with video recording")
+        message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}")
         include_directories(${FFMPEG_INCLUDE_DIR})
         set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
-        set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
         IF (WIN32)
             # there are some problems with linking our avwrapper as static lib, so link it as shared
             add_library(avwrapper SHARED avwrapper.c)
@@ -215,7 +213,7 @@
             add_dependencies(avwrapper ENGINECLEAN)
         endif()
     else()
-        message(STATUS "FFMPEG library not found, video recording will be disabled")
+        message(STATUS "Could NOT find FFMPEG, video recording will be disabled")
     endif()
 else()
     message(STATUS "Video recording disabled by user")
--- a/misc/liblua/CMakeLists.txt	Thu Sep 27 13:37:10 2012 -0400
+++ b/misc/liblua/CMakeLists.txt	Fri Sep 28 18:03:32 2012 +0100
@@ -1,7 +1,6 @@
 #this file is included only when system Lua library is not found
 
 file(GLOB lua_src *.c *.h)
-set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
 
 if(WIN32)
     add_definitions(-DLUA_BUILD_AS_DLL)