annotate armadillo-3.900.4/CMakeLists.txt @ 84:55a047986812 tip

Update library URI so as not to be document-local
author Chris Cannam
date Wed, 22 Apr 2020 14:21:57 +0100
parents 1ec0e2823891
children
rev   line source
Chris@49 1
Chris@49 2 # Copyright (C) 2008-2013 NICTA (www.nicta.com.au)
Chris@49 3 # Copyright (C) 2008-2013 Conrad Sanderson
Chris@49 4 # Copyright (C) 2011 Clement Creusot
Chris@49 5 #
Chris@49 6 # This Source Code Form is subject to the terms of the Mozilla Public
Chris@49 7 # License, v. 2.0. If a copy of the MPL was not distributed with this
Chris@49 8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
Chris@49 9
Chris@49 10
Chris@49 11
Chris@49 12 cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
Chris@49 13
Chris@49 14 set(ARMA_MAJOR 3)
Chris@49 15 set(ARMA_MINOR 900)
Chris@49 16 set(ARMA_PATCH 4)
Chris@49 17
Chris@49 18 message(STATUS "Configuring Armadillo ${ARMA_MAJOR}.${ARMA_MINOR}.${ARMA_PATCH}")
Chris@49 19
Chris@49 20 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build_aux/cmake/Modules/")
Chris@49 21
Chris@49 22 include(CheckIncludeFileCXX)
Chris@49 23 include(CheckLibraryExists)
Chris@49 24 include(FindBoost)
Chris@49 25 include(ARMA_CheckProto)
Chris@49 26 include(ARMA_CheckMathProto)
Chris@49 27
Chris@49 28 project(armadillo CXX)
Chris@49 29
Chris@49 30 set(ARMA_USE_LAPACK false)
Chris@49 31 set(ARMA_USE_BLAS false)
Chris@49 32 set(ARMA_USE_ATLAS false)
Chris@49 33 set(ARMA_USE_BOOST false)
Chris@49 34 set(ARMA_USE_HDF5 false)
Chris@49 35 set(ARMA_USE_WRAPPER true )
Chris@49 36
Chris@49 37 # NOTE:
Chris@49 38 # Set ARMA_USE_WRAPPER to false if you're getting linking errors when compiling your programs,
Chris@49 39 # or if you prefer to directly link with BLAS and/or LAPACK.
Chris@49 40 # You will then need to link your programs with -lblas -llapack instead of -larmadillo
Chris@49 41 # If you're using OpenBLAS, link your programs with -lopenblas -llapack instead of -larmadillo
Chris@49 42
Chris@49 43
Chris@49 44 message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
Chris@49 45
Chris@49 46
Chris@49 47 if(WIN32)
Chris@49 48 message(STATUS "")
Chris@49 49 message(STATUS "WARNING:")
Chris@49 50 message(STATUS "Automatic installation is currently not available for this platform.")
Chris@49 51 message(STATUS "Please use the manual installation, as described in the README.txt file.")
Chris@49 52 message(STATUS "You can also use the 'include' folder directly, but you may want to edit")
Chris@49 53 message(STATUS "'include/armadillo_bits/config.hpp' if you have LAPACK installed.")
Chris@49 54 message(STATUS "")
Chris@49 55 endif()
Chris@49 56
Chris@49 57
Chris@49 58
Chris@49 59 #
Chris@49 60 # Find LAPACK and BLAS libraries, or their optimised versions
Chris@49 61 #
Chris@49 62
Chris@49 63 if(APPLE)
Chris@49 64 set(ARMA_OS macos)
Chris@49 65
Chris@49 66 set(ARMA_USE_LAPACK true)
Chris@49 67 set(ARMA_USE_BLAS true)
Chris@49 68
Chris@49 69 # Under MacOS, the current version of ARMA_FindCLAPACK can get confused between
Chris@49 70 # two incompatible versions of "clapack.h" (one provided by the system and one
Chris@49 71 # provided by ATLAS). As such, use of ATLAS under MacOS is disabled for now.
Chris@49 72
Chris@49 73 else()
Chris@49 74 set(ARMA_OS unix)
Chris@49 75
Chris@49 76 include(ARMA_FindMKL)
Chris@49 77 include(ARMA_FindACMLMP)
Chris@49 78 include(ARMA_FindACML)
Chris@49 79
Chris@49 80 message(STATUS " MKL_FOUND = ${MKL_FOUND}")
Chris@49 81 message(STATUS "ACMLMP_FOUND = ${ACMLMP_FOUND}")
Chris@49 82 message(STATUS " ACML_FOUND = ${ACML_FOUND}")
Chris@49 83
Chris@49 84 if(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND)
Chris@49 85
Chris@49 86 set(ARMA_USE_BLAS true)
Chris@49 87 set(ARMA_USE_LAPACK true)
Chris@49 88
Chris@49 89 message(STATUS "")
Chris@49 90 message(STATUS "*** If the MKL or ACML libraries are installed in")
Chris@49 91 message(STATUS "*** /opt or /usr/local, make sure the run-time linker can find them.")
Chris@49 92 message(STATUS "*** On Linux systems this can be done by editing /etc/ld.so.conf")
Chris@49 93 message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.")
Chris@49 94 message(STATUS "*** On systems with SELinux enabled (eg. Fedora, RHEL),")
Chris@49 95 message(STATUS "*** you may need to change the SELinux type of all MKL/ACML libraries")
Chris@49 96 message(STATUS "*** to fix permission problems that may occur during run-time.")
Chris@49 97 message(STATUS "*** See README.txt for more information")
Chris@49 98
Chris@49 99 else()
Chris@49 100
Chris@49 101 include(ARMA_FindLAPACK)
Chris@49 102 include(ARMA_FindOpenBLAS)
Chris@49 103 include(ARMA_FindBLAS)
Chris@49 104 include(ARMA_FindCLAPACK)
Chris@49 105 include(ARMA_FindCBLAS)
Chris@49 106
Chris@49 107 message(STATUS " LAPACK_FOUND = ${LAPACK_FOUND}")
Chris@49 108 message(STATUS " BLAS_FOUND = ${BLAS_FOUND}")
Chris@49 109 message(STATUS "OpenBLAS_FOUND = ${OpenBLAS_FOUND}")
Chris@49 110 message(STATUS " CLAPACK_FOUND = ${CLAPACK_FOUND}")
Chris@49 111 message(STATUS " CBLAS_FOUND = ${CBLAS_FOUND}")
Chris@49 112
Chris@49 113 if(LAPACK_FOUND)
Chris@49 114 set(ARMA_USE_LAPACK true)
Chris@49 115 endif()
Chris@49 116
Chris@49 117 if(BLAS_FOUND)
Chris@49 118 set(ARMA_USE_BLAS true)
Chris@49 119 endif()
Chris@49 120
Chris@49 121 if(OpenBLAS_FOUND AND CLAPACK_FOUND AND CBLAS_FOUND)
Chris@49 122 message(STATUS "")
Chris@49 123 message(STATUS "*** WARNING: both OpenBLAS and ATLAS have been found; ATLAS will not be used")
Chris@49 124 endif()
Chris@49 125
Chris@49 126 if(OpenBLAS_FOUND)
Chris@49 127
Chris@49 128 set(ARMA_USE_BLAS true)
Chris@49 129
Chris@49 130 message(STATUS "")
Chris@49 131 message(STATUS "*** If the OpenBLAS library is installed in")
Chris@49 132 message(STATUS "*** /usr/local/lib or /usr/local/lib64")
Chris@49 133 message(STATUS "*** make sure the run-time linker can find it.")
Chris@49 134 message(STATUS "*** On Linux systems this can be done by editing /etc/ld.so.conf")
Chris@49 135 message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.")
Chris@49 136
Chris@49 137 else()
Chris@49 138
Chris@49 139 if(CLAPACK_FOUND AND CBLAS_FOUND)
Chris@49 140 message(STATUS "CLAPACK_INCLUDE_DIR = ${CLAPACK_INCLUDE_DIR}")
Chris@49 141 message(STATUS " CBLAS_INCLUDE_DIR = ${CBLAS_INCLUDE_DIR}")
Chris@49 142
Chris@49 143 if(${CLAPACK_INCLUDE_DIR} STREQUAL ${CBLAS_INCLUDE_DIR})
Chris@49 144 set(ARMA_USE_ATLAS true)
Chris@49 145 set(ARMA_ATLAS_INCLUDE_DIR ${CLAPACK_INCLUDE_DIR})
Chris@49 146 endif()
Chris@49 147 endif()
Chris@49 148
Chris@49 149 endif()
Chris@49 150
Chris@49 151 endif()
Chris@49 152
Chris@49 153 endif()
Chris@49 154
Chris@49 155
Chris@49 156 if(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND)
Chris@49 157
Chris@49 158 if(MKL_FOUND)
Chris@49 159 set(ARMA_LIBS ${ARMA_LIBS} ${MKL_LIBRARIES})
Chris@49 160
Chris@49 161 if(ACMLMP_FOUND OR ACML_FOUND)
Chris@49 162 message(STATUS "*** Intel MKL as well as AMD ACML libraries were found.")
Chris@49 163 message(STATUS "*** Using only the MKL library to avoid linking conflicts.")
Chris@49 164 message(STATUS "*** If you wish to use ACML instead, please link manually with")
Chris@49 165 message(STATUS "*** acml or acml_mp instead of the armadillo run-time component.")
Chris@49 166 message(STATUS "*** Alternatively, remove MKL from your system and rerun")
Chris@49 167 message(STATUS "*** Armadillo's configuration using ./configure")
Chris@49 168 endif()
Chris@49 169
Chris@49 170 else()
Chris@49 171
Chris@49 172 if(ACMLMP_FOUND)
Chris@49 173 set(ARMA_LIBS ${ARMA_LIBS} ${ACMLMP_LIBRARIES})
Chris@49 174
Chris@49 175 message(STATUS "*** Both single-core and multi-core ACML libraries were found.")
Chris@49 176 message(STATUS "*** Using only the multi-core library to avoid linking conflicts.")
Chris@49 177 else()
Chris@49 178 if(ACML_FOUND)
Chris@49 179 set(ARMA_LIBS ${ARMA_LIBS} ${ACML_LIBRARIES})
Chris@49 180 endif()
Chris@49 181 endif()
Chris@49 182
Chris@49 183 endif()
Chris@49 184
Chris@49 185 else()
Chris@49 186
Chris@49 187 if(ARMA_USE_BLAS STREQUAL true)
Chris@49 188 if(OpenBLAS_FOUND)
Chris@49 189 set(ARMA_LIBS ${ARMA_LIBS} ${OpenBLAS_LIBRARIES})
Chris@49 190 else()
Chris@49 191 set(ARMA_LIBS ${ARMA_LIBS} ${BLAS_LIBRARIES})
Chris@49 192 endif()
Chris@49 193 endif()
Chris@49 194
Chris@49 195 if(ARMA_USE_LAPACK STREQUAL true)
Chris@49 196 set(ARMA_LIBS ${ARMA_LIBS} ${LAPACK_LIBRARIES})
Chris@49 197 endif()
Chris@49 198
Chris@49 199 if(ARMA_USE_ATLAS STREQUAL true)
Chris@49 200 set(ARMA_LIBS ${ARMA_LIBS} ${CBLAS_LIBRARIES})
Chris@49 201 set(ARMA_LIBS ${ARMA_LIBS} ${CLAPACK_LIBRARIES})
Chris@49 202 endif()
Chris@49 203
Chris@49 204 endif()
Chris@49 205
Chris@49 206
Chris@49 207 if(APPLE)
Chris@49 208 set(ARMA_LIBS ${ARMA_LIBS} "-framework Accelerate") # or "-framework accelerate" ?
Chris@49 209 message(STATUS "MacOS X detected. Added '-framework Accelerate' to compiler flags")
Chris@49 210
Chris@49 211 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Chris@49 212 add_definitions(
Chris@49 213 -stdlib=libc++
Chris@49 214 )
Chris@49 215 message(STATUS "Clang compiler on MacOS X detected. Added '-stdlib=libc++' to compiler flags")
Chris@49 216 endif()
Chris@49 217
Chris@49 218 endif()
Chris@49 219
Chris@49 220
Chris@49 221 # if(CMAKE_VERSION VERSION_GREATER "2.7")
Chris@49 222 # find_package(HDF5)
Chris@49 223 # message(STATUS "HDF5_FOUND = ${HDF5_FOUND}")
Chris@49 224 #
Chris@49 225 # if(HDF5_FOUND)
Chris@49 226 # set(ARMA_USE_HDF5 true)
Chris@49 227 # set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${HDF5_INCLUDE_DIRS})
Chris@49 228 # set(ARMA_LIBS ${ARMA_LIBS} ${HDF5_LIBRARIES})
Chris@49 229 # endif()
Chris@49 230 # endif()
Chris@49 231
Chris@49 232
Chris@49 233 message(STATUS "")
Chris@49 234 message(STATUS "*** The run-time library component of Armadillo will be an alias for the following libraries:")
Chris@49 235 message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
Chris@49 236 message(STATUS "")
Chris@49 237
Chris@49 238 find_package(Boost)
Chris@49 239
Chris@49 240 if(Boost_FOUND)
Chris@49 241
Chris@49 242 message(STATUS "Boost_MAJOR_VERSION = ${Boost_MAJOR_VERSION}")
Chris@49 243 message(STATUS "Boost_MINOR_VERSION = ${Boost_MINOR_VERSION}")
Chris@49 244
Chris@49 245 if(Boost_MAJOR_VERSION GREATER 0)
Chris@49 246 if(Boost_MINOR_VERSION GREATER 33)
Chris@49 247 set(ARMA_USE_BOOST true)
Chris@49 248 message(STATUS "Boost_INCLUDE_DIR = ${Boost_INCLUDE_DIR}")
Chris@49 249 endif()
Chris@49 250 endif()
Chris@49 251
Chris@49 252 endif()
Chris@49 253
Chris@49 254 if(ARMA_USE_BOOST STREQUAL false)
Chris@49 255 message(STATUS "Boost libraries either not found or their version is too low (1.34 or later is good).")
Chris@49 256 message(STATUS "( It's possible that CMake didn't find the particular version of Boost you may have. )")
Chris@49 257 message(STATUS "( If that's the case, please edit include/armadillo_bits/config.hpp manually. )")
Chris@49 258 endif()
Chris@49 259
Chris@49 260
Chris@49 261 # If Boost libraries were found, explicitly check if Boost's date_time library is also present.
Chris@49 262
Chris@49 263 if(ARMA_USE_BOOST STREQUAL true)
Chris@49 264 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Boost_INCLUDE_DIR})
Chris@49 265 CHECK_INCLUDE_FILE_CXX("boost/date_time/posix_time/posix_time.hpp" ARMA_USE_BOOST_DATE)
Chris@49 266 endif()
Chris@49 267
Chris@49 268 ARMA_CHECK_MATH_PROTO("isfinite" "std" "cmath" ARMA_HAVE_STD_ISFINITE)
Chris@49 269 ARMA_CHECK_MATH_PROTO("isinf" "std" "cmath" ARMA_HAVE_STD_ISINF)
Chris@49 270 ARMA_CHECK_MATH_PROTO("isnan" "std" "cmath" ARMA_HAVE_STD_ISNAN)
Chris@49 271 ARMA_CHECK_MATH_PROTO("log1p" "" "cmath" ARMA_HAVE_LOG1P)
Chris@49 272
Chris@49 273 ARMA_CHECK_PROTO("snprintf" "std" "cstdio" ARMA_HAVE_STD_SNPRINTF)
Chris@49 274 ARMA_CHECK_PROTO("gettimeofday" "" "sys/time.h" ARMA_HAVE_GETTIMEOFDAY)
Chris@49 275
Chris@49 276
Chris@49 277 message(STATUS "Generating 'include/armadillo_bits/config.hpp'")
Chris@49 278 configure_file(include/armadillo_bits/config.hpp.cmake include/armadillo_bits/config.hpp)
Chris@49 279
Chris@49 280 message(STATUS "Generating 'examples/Makefile'")
Chris@49 281 configure_file(examples/Makefile.cmake examples/Makefile)
Chris@49 282
Chris@49 283
Chris@49 284 if(ARMA_USE_BOOST STREQUAL true)
Chris@49 285 include_directories(include ${Boost_INCLUDE_DIR})
Chris@49 286 else()
Chris@49 287 include_directories(include)
Chris@49 288 endif()
Chris@49 289
Chris@49 290
Chris@49 291 ## For any library that is not in a default location,
Chris@49 292 ## embed its path into the Armadillo runtime library.
Chris@49 293 ## Examples of default locations are "/lib", "/usr/lib",
Chris@49 294 ## or as specified in "/etc/ld.so.conf".
Chris@49 295 ##
Chris@49 296 ## Path embedding is not recommended unless you know
Chris@49 297 ## what you're doing. It might be better to add the
Chris@49 298 ## path to the "/etc/ld.so.conf" file and then run "ldconfig".
Chris@49 299 ##
Chris@49 300 #set(CMAKE_SKIP_BUILD_RPATH FALSE)
Chris@49 301 #set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
Chris@49 302 #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Chris@49 303
Chris@49 304
Chris@49 305 # work around a silly limitation in Mac OS X
Chris@49 306 if(APPLE)
Chris@49 307 if(${ARMA_MINOR} GREATER 99)
Chris@49 308 math(EXPR ARMA_MINOR_ALT "${ARMA_MINOR} / 10")
Chris@49 309 else()
Chris@49 310 set(ARMA_MINOR_ALT ${ARMA_MINOR})
Chris@49 311 endif()
Chris@49 312 else()
Chris@49 313 set(ARMA_MINOR_ALT ${ARMA_MINOR})
Chris@49 314 endif()
Chris@49 315
Chris@49 316
Chris@49 317 # necessary when linking with Intel MKL on Linux systems
Chris@49 318 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Chris@49 319 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
Chris@49 320 message(STATUS "CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}")
Chris@49 321 endif()
Chris@49 322
Chris@49 323 add_library( armadillo SHARED src/wrap_libs )
Chris@49 324 target_link_libraries( armadillo ${ARMA_LIBS} )
Chris@49 325 set_target_properties(armadillo PROPERTIES VERSION ${ARMA_MAJOR}.${ARMA_MINOR_ALT}.${ARMA_PATCH} SOVERSION ${ARMA_MAJOR})
Chris@49 326
Chris@49 327
Chris@49 328 ################################################################################
Chris@49 329 # INSTALL CONFIGURATION
Chris@49 330
Chris@49 331
Chris@49 332 # As Red Hat Enterprise Linux (and related systems such as Fedora)
Chris@49 333 # does not search /usr/local/lib by default, we need to place the
Chris@49 334 # library in either /usr/lib or /usr/lib64
Chris@49 335
Chris@49 336 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Chris@49 337 message(STATUS "*** CMAKE_INSTALL_PREFIX was initalised by cmake to the default value of ${CMAKE_INSTALL_PREFIX}")
Chris@49 338 message(STATUS "*** CMAKE_INSTALL_PREFIX changed to /usr")
Chris@49 339 unset(CMAKE_INSTALL_PREFIX)
Chris@49 340 set(CMAKE_INSTALL_PREFIX "/usr")
Chris@49 341 #set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "install prefix" FORCE)
Chris@49 342 endif()
Chris@49 343
Chris@49 344 # Allow for the "lib" directory to be specified on the command line
Chris@49 345 if(NOT INSTALL_LIB_DIR)
Chris@49 346 set(INSTALL_LIB_DIR "lib")
Chris@49 347 if(UNIX AND NOT APPLE) # I don't know how Mac OS handles 64 bit systems
Chris@49 348 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Chris@49 349 message(STATUS "*** Detected 64 bit system")
Chris@49 350 # use "lib64" only on systems that have it (eg. Fedora, Red Hat).
Chris@49 351 # if installing in /usr/local/, the use of lib64 might be unreliable on systems which have /usr/local/lib64 but don't use it
Chris@49 352 if(IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib64")
Chris@49 353 unset(INSTALL_LIB_DIR)
Chris@49 354 set(INSTALL_LIB_DIR "lib64")
Chris@49 355 message(STATUS "*** ${CMAKE_INSTALL_PREFIX}/lib64/ exists, so destination directory for the run-time library changed to ${CMAKE_INSTALL_PREFIX}/lib64/")
Chris@49 356 message(STATUS "*** Your system and/or compiler must search ${CMAKE_INSTALL_PREFIX}/lib64/ during linking")
Chris@49 357 endif()
Chris@49 358 endif()
Chris@49 359 endif()
Chris@49 360 endif()
Chris@49 361
Chris@49 362 # Allow for the "include" directory to be specified on the command line
Chris@49 363
Chris@49 364 if(NOT INSTALL_INCLUDE_DIR)
Chris@49 365 set(INSTALL_INCLUDE_DIR "include")
Chris@49 366 endif()
Chris@49 367
Chris@49 368 # We use data dir to store files shared with other programs
Chris@49 369 # like the ArmadilloConfig.cmake file.
Chris@49 370 if(NOT INSTALL_DATA_DIR)
Chris@49 371 set(INSTALL_DATA_DIR "share")
Chris@49 372 endif()
Chris@49 373
Chris@49 374 # Make relative paths absolute so we can write them in Config.cmake files
Chris@49 375 foreach(p LIB INCLUDE DATA)
Chris@49 376 set(var INSTALL_${p}_DIR)
Chris@49 377 if(NOT IS_ABSOLUTE "${${var}}")
Chris@49 378 set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
Chris@49 379 endif()
Chris@49 380 endforeach()
Chris@49 381
Chris@49 382 message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
Chris@49 383 message(STATUS "INSTALL_LIB_DIR = ${INSTALL_LIB_DIR}" )
Chris@49 384 message(STATUS "INSTALL_INCLUDE_DIR = ${INSTALL_INCLUDE_DIR}" )
Chris@49 385 message(STATUS "INSTALL_DATA_DIR = ${INSTALL_DATA_DIR}" )
Chris@49 386
Chris@49 387
Chris@49 388 # Note that the trailing / character in "include/" is critical
Chris@49 389
Chris@49 390 install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}
Chris@49 391 PATTERN ".svn" EXCLUDE
Chris@49 392 PATTERN "*.cmake" EXCLUDE
Chris@49 393 PATTERN "*~" EXCLUDE
Chris@49 394 PATTERN "*orig" EXCLUDE
Chris@49 395 )
Chris@49 396
Chris@49 397 install(FILES ${PROJECT_BINARY_DIR}/include/armadillo_bits/config.hpp
Chris@49 398 DESTINATION ${INSTALL_INCLUDE_DIR}/armadillo_bits
Chris@49 399 )
Chris@49 400
Chris@49 401 install(TARGETS armadillo
Chris@49 402 DESTINATION ${INSTALL_LIB_DIR}
Chris@49 403 EXPORT ArmadilloLibraryDepends)
Chris@49 404
Chris@49 405 # Export the package for use from the build-tree
Chris@49 406 # (this registers the build-tree with a global CMake-registry)
Chris@49 407 if(CMAKE_VERSION VERSION_GREATER "2.7")
Chris@49 408 export(PACKAGE armadillo)
Chris@49 409 endif()
Chris@49 410
Chris@49 411 ## LOCAL FILES
Chris@49 412 # Create ArmadilloConfig.cmake file for the use from the build tree
Chris@49 413 set(ARMADILLO_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
Chris@49 414 set(ARMADILLO_LIB_DIR "${PROJECT_BINARY_DIR}")
Chris@49 415 set(ARMADILLO_CMAKE_DIR "${PROJECT_BINARY_DIR}")
Chris@49 416
Chris@49 417
Chris@49 418 message(STATUS "Generating '${PROJECT_BINARY_DIR}/ArmadilloConfig.cmake'")
Chris@49 419 # copy/change config and configVersion file (modify only the @xyz@ variables)
Chris@49 420 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfig.cmake.in
Chris@49 421 "${PROJECT_BINARY_DIR}/ArmadilloConfig.cmake" @ONLY)
Chris@49 422
Chris@49 423 message(STATUS "Generating '${PROJECT_BINARY_DIR}/ArmadilloConfigVersion.cmake'")
Chris@49 424 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfigVersion.cmake.in
Chris@49 425 "${PROJECT_BINARY_DIR}/ArmadilloConfigVersion.cmake" @ONLY)
Chris@49 426
Chris@49 427
Chris@49 428 # Install the export set for use with the install-tree
Chris@49 429 install(EXPORT ArmadilloLibraryDepends DESTINATION
Chris@49 430 "${INSTALL_DATA_DIR}/Armadillo/CMake"
Chris@49 431 COMPONENT dev)
Chris@49 432
Chris@49 433
Chris@49 434 ## GLOBAL INSTALL FILES
Chris@49 435 # Create ArmadilloConfig.cmake file for the use from the install tree
Chris@49 436 # and install it
Chris@49 437 set(ARMADILLO_INCLUDE_DIRS "${INSTALL_INCLUDE_DIR}")
Chris@49 438 set(ARMADILLO_LIB_DIR "${INSTALL_LIB_DIR}")
Chris@49 439 set(ARMADILLO_CMAKE_DIR "${INSTALL_DATA_DIR}/Armadillo/CMake")
Chris@49 440
Chris@49 441
Chris@49 442 message(STATUS "Generating '${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake'")
Chris@49 443 # copy/change config and configVersion file (modify only the @xyz@ variables)
Chris@49 444 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfig.cmake.in
Chris@49 445 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake" @ONLY)
Chris@49 446
Chris@49 447 message(STATUS "Generating '${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake'")
Chris@49 448 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfigVersion.cmake.in
Chris@49 449 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake" @ONLY)
Chris@49 450
Chris@49 451 # Install files to be found by cmake users with find_package()
Chris@49 452 install(FILES
Chris@49 453 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake"
Chris@49 454 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake"
Chris@49 455 DESTINATION "${ARMADILLO_CMAKE_DIR}" COMPONENT dev)