CMake: add check_find_package_result macro.

This commit is contained in:
f3nix 2008-04-13 14:00:01 +00:00
parent 945f5f1e42
commit 2c7eaa608b
4 changed files with 18 additions and 22 deletions

View File

@ -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 mark_as_advanced(KICAD_BIN KICAD_PLUGINS KICAD_DATA KICAD_DOCS
KICAD_DEMOS KICAD_INTERNAT KICAD_TEMPLATE) KICAD_DEMOS KICAD_INTERNAT KICAD_TEMPLATE)
# Find libraries that are needed to build KiCad.
include(CheckFindPackageResult)
find_package(OpenGL) find_package(OpenGL)
if(OPENGL_FOUND) check_find_package_result(OPENGL_FOUND "OpenGL")
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)
find_package(Boost) find_package(Boost)
if(Boost_FOUND) check_find_package_result(Boost_FOUND "Boost")
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)
# Here you can define what libraries of wxWidgets you need for your # Here you can define what libraries of wxWidgets you need for your
# application. You can figure out what libraries you need here; # application. You can figure out what libraries you need here;
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html # http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
set(wxWidgets_USE_LIBS base core adv gl html net) set(wxWidgets_USE_LIBS base core adv gl html net)
find_package(wxWidgetsCVS) find_package(wxWidgetsCVS)
if(wxWidgets_FOUND) check_find_package_result(wxWidgets_FOUND "wxWidgets")
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)
# Include wxWidgets macros. # Include wxWidgets macros.
include(${wxWidgets_USE_FILE}) include(${wxWidgets_USE_FILE})

View File

@ -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)

View File

@ -41,9 +41,9 @@ MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
ENDFOREACH(_CURRENT_VAR) ENDFOREACH(_CURRENT_VAR)
IF (${_NAME_UPPER}_FOUND) IF (${_NAME_UPPER}_FOUND)
IF (NOT ${_NAME}_FIND_QUIETLY) # IF (NOT ${_NAME}_FIND_QUIETLY)
MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") # MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
ENDIF (NOT ${_NAME}_FIND_QUIETLY) # ENDIF (NOT ${_NAME}_FIND_QUIETLY)
ELSE (${_NAME_UPPER}_FOUND) ELSE (${_NAME_UPPER}_FOUND)
IF (${_NAME}_FIND_REQUIRED) IF (${_NAME}_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}") MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")

View File

@ -1,4 +1,4 @@
find_package(ZLIB) find_package(ZLIB QUIET)
if(ZLIB_FOUND) if(ZLIB_FOUND)
message(STATUS "Check for installed zlib -- found") message(STATUS "Check for installed zlib -- found")
else(ZLIB_FOUND) else(ZLIB_FOUND)