even more wrapping with find_package_or_disable_msg
authorkoda
Thu, 07 Mar 2013 11:55:00 +0100 (2013-03-07)
changeset 8688 88a6114a318c
parent 8687 5b6ad1bd6ace
child 8689 720bdd41154e
even more wrapping with find_package_or_disable_msg
CMakeLists.txt
QTfrontend/CMakeLists.txt
cmake_modules/utils.cmake
hedgewars/CMakeLists.txt
--- a/CMakeLists.txt	Thu Mar 07 10:16:21 2013 +0100
+++ b/CMakeLists.txt	Thu Mar 07 11:55:00 2013 +0100
@@ -333,12 +333,7 @@
     list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}" "-dPHYSFS_INTERNAL")
 endif()
 
-if(NOT NOVIDEOREC)
-    find_package_or_disable(FFMPEG NOVIDEOREC)
-else()
-    message(STATUS "Video recording disabled")
-    set(FFMPEG_FOUND false)
-endif()
+find_package_or_disable_msg(FFMPEG NOVIDEOREC "Video recording will not be built")
 
 #physfs helper library
 add_subdirectory(misc/libphyslayer)
--- a/QTfrontend/CMakeLists.txt	Thu Mar 07 10:16:21 2013 +0100
+++ b/QTfrontend/CMakeLists.txt	Thu Mar 07 11:55:00 2013 +0100
@@ -166,15 +166,13 @@
                          util/platform/M3InstallController.m
                          util/platform/NSWorkspace_RBAdditions.m
                          )
-    if(NOT NOAUTOUPDATE)
-        include(${CMAKE_MODULE_PATH}/utils.cmake)
-        find_package_or_disable(Sparkle NOAUTOUPDATE)
+    include(${CMAKE_MODULE_PATH}/utils.cmake)
+    find_package_or_disable_msg(Sparkle NOAUTOUPDATE "Autoupdater will not be built.")
+    if(SPARKLE_FOUND)
         add_definitions(-DSPARKLE_ENABLED)
         list(APPEND hwfr_src util/platform/AutoUpdater.cpp
                              util/platform/SparkleAutoUpdater.mm)
         list(APPEND HW_LINK_LIBS ${SPARKLE_LIBRARY})
-    else()
-        message(STATUS "Sparkle autoupdater disabled")
     endif()
 endif()
 
--- a/cmake_modules/utils.cmake	Thu Mar 07 10:16:21 2013 +0100
+++ b/cmake_modules/utils.cmake	Thu Mar 07 11:55:00 2013 +0100
@@ -15,5 +15,16 @@
     endif(NOT ${_PKG_NAME_UP}_FOUND)
 endmacro(find_package_or_disable _PKG_NAME _VAR_NAME)
 
+macro(find_package_or_disable_msg _PKG_NAME _VAR_NAME _MSG)
+    if(NOT ${_VAR_NAME})
+        find_package_or_disable(${_PKG_NAME} ${_VAR_NAME})
+    else(NOT ${_VAR_NAME})
+        message(STATUS "${_PKG_NAME} disabled. ${_MSG}")
+        string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP)
+        set(${_PKG_NAME_UP}_FOUND false)
+    endif(NOT ${_VAR_NAME})
+endmacro(find_package_or_disable_msg _PKG_NAME _VAR_NAME _MSG)
+
+
 #TODO: find_package_or_bundle
 
--- a/hedgewars/CMakeLists.txt	Thu Mar 07 10:16:21 2013 +0100
+++ b/hedgewars/CMakeLists.txt	Thu Mar 07 11:55:00 2013 +0100
@@ -165,11 +165,9 @@
     list(APPEND pascal_flags "-FD${compiler_dir}")
 endif(APPLE)
 
-if(NOT NOPNG)
-    find_package_or_disable(PNG NOPNG)
+find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
+if(PNG_FOUND)
     list(APPEND pascal_flags "-dPNG_SCREENSHOTS")
-else()
-    message(STATUS "PNG screenshots disabled, using BMP format")
 endif()