Commit 482369b6 authored by Jorrit Schaap's avatar Jorrit Schaap

SW-90: made some changes in the cmake/lofar find_package logic: when we want...

SW-90: made some changes in the cmake/lofar find_package logic: when we want the BUILD_DOCUMENTATION, then the REQUIRED option is removed from the (lofar)_find_package calls. This allows cmake to finish configuring and generating Makefiles, and allows us to build the target doc, but probably not parts of the code when external packages are not found. That's ok, and intentional.
parent 99f1d6db
......@@ -42,9 +42,23 @@ find_package(PythonInterp)
# -----------------------------------------------------------------------------
include(CMakeParseArguments)
macro(find_python_module _module)
function(find_python_module _module)
# Name of module in uppercase.
string(TOUPPER "${_module}" _MODULE)
list(FIND ARGV REQUIRED is_required)
IF(BUILD_DOCUMENTATION)
IF(is_required GREATER -1)
# Removing REQUIRED option while looking for package.
# This allows cmake to continue configuring so you could make the doc,
# but building the code might not be possible.
# In case the package is not found, a WARNING is issued below.
list(REMOVE_ITEM ARGV REQUIRED)
list(REMOVE_ITEM ARGN REQUIRED)
ENDIF()
ENDIF(BUILD_DOCUMENTATION)
cmake_parse_arguments(PYTHON_${_MODULE}_FIND
"REQUIRED"
"HINTS"
......@@ -83,4 +97,10 @@ macro(find_python_module _module)
find_package_handle_standard_args(PYTHON_${_MODULE} DEFAULT_MSG
PYTHON_${_MODULE})
endmacro()
if(NOT PYTHON_${_MODULE}_FOUND)
if(is_required GREATER -1)
message(WARNING "Removed REQUIRED option while looking for python module '${_module}' because BUILD_DOCUMENTATION=${BUILD_DOCUMENTATION}. This allows cmake to continue configuring so you could make the doc, but building the code might not be possible.")
endif(is_required GREATER -1)
endif(NOT PYTHON_${_MODULE}_FOUND)
endfunction()
......@@ -41,7 +41,6 @@ function(lofar_find_package _package)
string(TOUPPER ${_package} _PKG)
if(NOT ${_PKG}_FOUND)
# Set CMAKE_PREFIX_PATH, used by the find_xxx() commands, to the package's
# root directory ${_PKG}_ROOT_DIR, if defined; otherwise set it to the
# LOFAR search path.
......@@ -51,6 +50,19 @@ function(lofar_find_package _package)
lofar_search_path(CMAKE_PREFIX_PATH ${_pkg})
endif(${_PKG}_ROOT_DIR)
list(FIND ARGV REQUIRED is_required)
IF(BUILD_DOCUMENTATION)
IF(is_required GREATER -1)
# Removing REQUIRED option while looking for package.
# This allows cmake to continue configuring so you could make the doc,
# but building the code might not be possible.
# In case the package is not found, a WARNING is issued below.
list(REMOVE_ITEM ARGV REQUIRED)
list(REMOVE_ITEM ARGN REQUIRED)
ENDIF()
ENDIF(BUILD_DOCUMENTATION)
# Search the package using the Find${_package}.cmake module, unless the
# package have been disabled explicitly.
if(NOT DEFINED USE_${_PKG} OR USE_${_PKG})
......@@ -60,10 +72,10 @@ function(lofar_find_package _package)
find_package(${ARGV} QUIET)
endif(LOFAR_VERBOSE_CONFIGURE)
else(NOT DEFINED USE_${_PKG} OR USE_${_PKG})
list(FIND ARGN REQUIRED is_required)
if(is_required GREATER -1)
message(SEND_ERROR
"Package ${_package} is required, but has been disabled explicitly!")
IF(NOT BUILD_DOCUMENTATION)
message(SEND_ERROR "Package ${_package} is required, but has been disabled explicitly!")
ENDIF(NOT BUILD_DOCUMENTATION)
else(is_required GREATER -1)
message(STATUS "Package ${_package} has been disabled explicitly")
endif(is_required GREATER -1)
......@@ -88,6 +100,9 @@ function(lofar_find_package _package)
PARENT_SCOPE)
else(${_PKG}_FOUND)
set(HAVE_${_PKG} FALSE CACHE INTERNAL "Have ${_package}?")
if(is_required GREATER -1)
message(WARNING "Removed REQUIRED option while looking for package '${_package}' because BUILD_DOCUMENTATION=${BUILD_DOCUMENTATION}. This allows cmake to continue configuring so you could make the doc, but building the code might not be possible.")
endif(is_required GREATER -1)
endif(${_PKG}_FOUND)
set(${_PKG}_FOUND ${${_PKG}_FOUND} PARENT_SCOPE)
......
......@@ -72,7 +72,14 @@ if(NOT DEFINED LOFAR_OPTIONS_INCLUDED)
endif(BUILD_STATIC_EXECUTABLES)
if(USE_BACKTRACE)
lofar_find_package(Backtrace REQUIRED)
IF(BUILD_DOCUMENTATION)
lofar_find_package(Backtrace)
IF(NOT HAVE_BACKTRACE)
message(WARNING "Removed REQUIRED option while looking for package 'Backtrace' because BUILD_DOCUMENTATION=${BUILD_DOCUMENTATION}. This allows cmake to continue configuring so you could make the doc, but building the code might not be possible.")
ENDIF()
ELSE()
lofar_find_package(Backtrace REQUIRED)
ENDIF(BUILD_DOCUMENTATION)
else(USE_BACKTRACE)
set(HAVE_BACKTRACE OFF)
endif(USE_BACKTRACE)
......
......@@ -8,7 +8,7 @@ IBS_Protocol CAL_Protocol RSP_Protocol TBB_Protocol VHECR CR_Protocol)
include(LofarFindPackage)
lofar_find_package(Blitz REQUIRED)
lofar_find_package(Boost REQUIRED date_time)
lofar_find_package(Boost REQUIRED COMPONENTS date_time)
add_subdirectory(include/APL/ClockProtocol)
add_subdirectory(src)
......@@ -3,7 +3,7 @@
lofar_package(TestCtlr 1.0 DEPENDS Common ApplCommon APLCommon MACIO GCFTM)
include(LofarFindPackage)
lofar_find_package(Boost REQUIRED date_time)
lofar_find_package(Boost REQUIRED COMPONENTS date_time)
add_definitions(-DBOOST_DISABLE_THREADS)
......
......@@ -4,7 +4,7 @@ lofar_package(BrokenAntennaInfo 1.0 DEPENDS Common OTDB CoInterface)
include(LofarFindPackage)
lofar_find_package(Casacore COMPONENTS casa measures REQUIRED)
lofar_find_package(Boost REQUIRED date_time)
lofar_find_package(Boost REQUIRED COMPONENTS date_time)
add_subdirectory(src)
add_subdirectory(test)
......@@ -42,7 +42,7 @@ elseif(USE_OPENCL AND NOT USE_CUDA)
lofar_find_package(OpenCL REQUIRED)
add_definitions(-DUSE_OPENCL)
else()
message(FATAL_ERROR
message(WARNING
"Either CUDA or OpenCL must be enabled to build GPUProc.")
endif()
......
......@@ -8,7 +8,15 @@ lofar_find_package(PQXX REQUIRED)
# Don't use lofar_find_package(JNI), because we don't need to link in the
# JNI libraries; we only need the JNI header files.
find_package(JNI REQUIRED)
IF(BUILD_DOCUMENTATION)
find_package(JNI)
IF(NOT JNI_FOUND)
message(WARNING "Removed REQUIRED option while looking for package 'JNI' because BUILD_DOCUMENTATION=${BUILD_DOCUMENTATION}. This allows cmake to continue configuring so you could make the doc, but building the code might not be possible.")
ENDIF()
ELSE()
find_package(JNI REQUIRED)
ENDIF()
include_directories(${JNI_INCLUDE_DIRS})
add_subdirectory(include/jOTDB3)
......
......@@ -3,11 +3,21 @@
lofar_package(Scheduler 1.0)
# Search for Qt4 and setup CMake environment for it
find_package(Qt4 COMPONENTS QtCore QtGui QtSql QtTest REQUIRED)
include(${QT_USE_FILE})
IF(BUILD_DOCUMENTATION)
find_package(Qt4 COMPONENTS QtCore QtGui QtSql QtTest)
IF(NOT Qt4_FOUND)
message(WARNING "Removed REQUIRED option while looking for package 'Qt4' because BUILD_DOCUMENTATION=${BUILD_DOCUMENTATION}. This allows cmake to continue configuring so you could make the doc, but building the code might not be possible.")
ENDIF()
ELSE()
find_package(Qt4 COMPONENTS QtCore QtGui QtSql QtTest REQUIRED)
ENDIF(BUILD_DOCUMENTATION)
# Add current source- and binary directory to include path
set(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(Qt4_FOUND)
include(${QT_USE_FILE})
add_subdirectory(src)
add_subdirectory(test)
# Add current source- and binary directory to include path
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_subdirectory(src)
add_subdirectory(test)
ENDIF(Qt4_FOUND)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment