# CASA - Common Astronomy Software Applications
# Copyright (C) 2010 by ESO (in the framework of the ALMA collaboration)
# This file is part of CASA.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Macros for defining libraries, executables, tests, etc
# In CASA, it does not make sense to build without also installing
# the build products. Therefore...
# Create a target which ensures that the install target is
# always run as part of all.
# For this to work, all other targets must be added as dependencies
# of this "inst" target. This is done in the macro's below using add_dependencies()
macro( casa_always_install )
add_custom_target( inst ALL ${CMAKE_BUILD_TOOL} install/fast )
if (NOT TARGET unit_test)
add_custom_target (unit_test COMMAND "cd" ${CMAKE_BINARY_DIR} COMMAND "ctest")
# Setup definitions and include directories for this module,
# and create a dynamic library
macro( casa_add_library module )
add_definitions( ${${module}_DEFINITIONS} )
# Treat all but the first include dir as a "system" one which will
# disable warnings form these often uneditable files. The first one
# is the path to code which is how CASA header files will be found
# and there is no leniency for them. Order of these files is set
list (GET ${module}_INCLUDE_DIRS 0 codeIncludeDir)
list (REMOVE_ITEM ${module}_INCLUDE_DIRS ${codeIncludeDir})
include_directories( SYSTEM ${${module}_INCLUDE_DIRS} )
include_directories( ${codeIncludeDir})