From 2c7eaa608b773ce15b757565d8122f945783d0bc Mon Sep 17 00:00:00 2001 From: f3nix Date: Sun, 13 Apr 2008 14:00:01 +0000 Subject: [PATCH] CMake: add check_find_package_result macro. --- CMakeLists.txt | 24 +++++-------------- CMakeModules/CheckFindPackageResult.cmake | 8 +++++++ .../FindPackageHandleStandardArgs.cmake | 6 ++--- kicad/minizip/CMakeLists.txt | 2 +- 4 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 CMakeModules/CheckFindPackageResult.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 68c1e14c9e..2ea63a2c57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,33 +56,21 @@ set(KICAD_TEMPLATE ${KICAD_DATA}/template CACHE PATH "Location of KiCad template mark_as_advanced(KICAD_BIN KICAD_PLUGINS KICAD_DATA KICAD_DOCS KICAD_DEMOS KICAD_INTERNAT KICAD_TEMPLATE) +# Find libraries that are needed to build KiCad. +include(CheckFindPackageResult) + find_package(OpenGL) -if(OPENGL_FOUND) - message(STATUS "Check for installed OpenGL -- found") -else(OPENGL_FOUND) - message(STATUS "Check for installed OpenGL -- not found") - message(FATAL_ERROR "OpenGL was not found - it is required to build KiCad") -endif(OPENGL_FOUND) +check_find_package_result(OPENGL_FOUND "OpenGL") find_package(Boost) -if(Boost_FOUND) - message(STATUS "Check for installed Boost -- found") -else(Boost_FOUND) - message(STATUS "Check for installed Boost -- not found") - message(FATAL_ERROR "Boost was not found - it is required to build KiCad") -endif(Boost_FOUND) +check_find_package_result(Boost_FOUND "Boost") # Here you can define what libraries of wxWidgets you need for your # application. You can figure out what libraries you need here; # http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html set(wxWidgets_USE_LIBS base core adv gl html net) find_package(wxWidgetsCVS) -if(wxWidgets_FOUND) - message(STATUS "Check for installed wxWidgets -- found") -else(wxWidgets_FOUND) - message(STATUS "Check for installed wxWidgets -- not found") - message(FATAL_ERROR "wxWidgets was not found - it is required to build KiCad") -endif(wxWidgets_FOUND) +check_find_package_result(wxWidgets_FOUND "wxWidgets") # Include wxWidgets macros. include(${wxWidgets_USE_FILE}) diff --git a/CMakeModules/CheckFindPackageResult.cmake b/CMakeModules/CheckFindPackageResult.cmake new file mode 100644 index 0000000000..fed71975ab --- /dev/null +++ b/CMakeModules/CheckFindPackageResult.cmake @@ -0,0 +1,8 @@ +macro(check_find_package_result _VAR _PKGNAME) + if(${_VAR}) + message(STATUS "Check for installed ${_PKGNAME} -- found") + else(${_VAR}) + message(STATUS "Check for installed ${_PKGNAME} -- not found") + message(FATAL_ERROR "${_PKGNAME} was not found - it is required to build KiCad") + endif(${_VAR}) +endmacro(check_find_package_result) diff --git a/CMakeModules/FindPackageHandleStandardArgs.cmake b/CMakeModules/FindPackageHandleStandardArgs.cmake index ba57386e7b..7dc5a6d213 100644 --- a/CMakeModules/FindPackageHandleStandardArgs.cmake +++ b/CMakeModules/FindPackageHandleStandardArgs.cmake @@ -41,9 +41,9 @@ MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) ENDFOREACH(_CURRENT_VAR) IF (${_NAME_UPPER}_FOUND) - IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") - ENDIF (NOT ${_NAME}_FIND_QUIETLY) +# IF (NOT ${_NAME}_FIND_QUIETLY) +# MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") +# ENDIF (NOT ${_NAME}_FIND_QUIETLY) ELSE (${_NAME_UPPER}_FOUND) IF (${_NAME}_FIND_REQUIRED) MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}") diff --git a/kicad/minizip/CMakeLists.txt b/kicad/minizip/CMakeLists.txt index ec0cca866a..90d65ff140 100644 --- a/kicad/minizip/CMakeLists.txt +++ b/kicad/minizip/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(ZLIB) +find_package(ZLIB QUIET) if(ZLIB_FOUND) message(STATUS "Check for installed zlib -- found") else(ZLIB_FOUND)