|
| 1 | +# Copyright (c) Lawrence Livermore National Security, LLC and other APComp |
| 2 | +# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and |
| 3 | +# other details. No copyright assignment is required to contribute to APComp. |
| 4 | + |
| 5 | +################################################################ |
| 6 | +# if BLT_SOURCE_DIR is not set - use "blt" as default |
| 7 | +################################################################ |
| 8 | +if(NOT BLT_SOURCE_DIR) |
| 9 | + set(BLT_SOURCE_DIR "blt") |
| 10 | +endif() |
| 11 | + |
| 12 | +################################################################ |
| 13 | +# if not set, prefer c++11 lang standard |
| 14 | +################################################################ |
| 15 | +if(NOT BLT_CXX_STD) |
| 16 | + set(BLT_CXX_STD "c++11" CACHE STRING "") |
| 17 | +endif() |
| 18 | + |
| 19 | +################################################################ |
| 20 | +# if not set, prefer folder grouped targets |
| 21 | +################################################################ |
| 22 | +if(NOT ENABLE_FOLDERS) |
| 23 | + set(ENABLE_FOLDERS TRUE CACHE STRING "") |
| 24 | +endif() |
| 25 | + |
| 26 | + |
| 27 | +################################################################ |
| 28 | +# init blt using BLT_SOURCE_DIR |
| 29 | +################################################################ |
| 30 | +include(${BLT_SOURCE_DIR}/SetupBLT.cmake) |
| 31 | + |
| 32 | +if(ENABLE_MPI) |
| 33 | + # on some platforms (mostly cray systems) folks skip mpi |
| 34 | + # detection in BLT by setting ENABLE_FIND_MPI = OFF |
| 35 | + # in these cases, we need to set FOUND_MPI = TRUE, |
| 36 | + # since the rest of our cmake logic to include MPI uses FOUND_MPI |
| 37 | + if(NOT ENABLE_FIND_MPI) |
| 38 | + set(FOUND_MPI ON CACHE BOOL "") |
| 39 | + endif() |
| 40 | + |
| 41 | + # adjust MPI from BLT |
| 42 | + if( ${CMAKE_VERSION} VERSION_LESS "3.15.0" ) |
| 43 | + # older cmake, we use BLT's mpi support, it uses |
| 44 | + # the name mpi |
| 45 | + set(apcomp_blt_mpi_deps mpi CACHE STRING "") |
| 46 | + else() |
| 47 | + if(TARGET MPI::MPI_CXX) |
| 48 | + message(STATUS "Using MPI CMake imported target: MPI::MPI_CXX") |
| 49 | + # newer cmake we use find mpi targets directly |
| 50 | + set(apcomp_blt_mpi_deps MPI::MPI_CXX CACHE STRING "") |
| 51 | + else() |
| 52 | + message(FATAL_ERROR "Cannot use CMake imported targets for MPI." |
| 53 | + "(CMake > 3.15, ENABLE_MPI == ON, but " |
| 54 | + "MPI::MPI_CXX CMake target is missing.)") |
| 55 | + endif() |
| 56 | + endif() |
| 57 | +endif() |
| 58 | + |
| 59 | + |
| 60 | +if(ENABLE_OPENMP) |
| 61 | + # adjust OpenMP from BLT |
| 62 | + if( ${CMAKE_VERSION} VERSION_LESS "3.9.0" ) |
| 63 | + # older cmake, we use BLT's openmp support, it uses |
| 64 | + # the name openmp |
| 65 | + set(apcomp_blt_openmp_deps openmp CACHE STRING "") |
| 66 | + else() |
| 67 | + if(TARGET OpenMP::OpenMP_CXX) |
| 68 | + message(STATUS "Using OpenMP CMake imported target: OpenMP::OpenMP_CXX") |
| 69 | + # newer cmake we openmp targets directly |
| 70 | + set(apcomp_blt_openmp_deps OpenMP::OpenMP_CXX CACHE STRING "") |
| 71 | + else() |
| 72 | + message(FATAL_ERROR "Cannot use CMake imported targets for OpenMP." |
| 73 | + "(CMake > 3.9, ENABLE_OPENMP == ON, but " |
| 74 | + "OpenMP::OpenMP_CXX CMake target is missing.)") |
| 75 | + endif() |
| 76 | + endif() |
| 77 | +endif() |
| 78 | + |
| 79 | + |
| 80 | +################################################################ |
| 81 | +# apply folders to a few ungrouped blt targets |
| 82 | +################################################################ |
| 83 | + |
| 84 | +############################################### |
| 85 | +# group main blt docs targets into docs folder |
| 86 | +############################################### |
| 87 | +blt_set_target_folder( TARGET docs FOLDER docs) |
| 88 | + |
| 89 | +if(TARGET sphinx_docs) |
| 90 | + blt_set_target_folder( TARGET sphinx_docs FOLDER docs) |
| 91 | +endif() |
| 92 | + |
| 93 | +if(TARGET doxygen_docs) |
| 94 | + blt_set_target_folder( TARGET doxygen_docs FOLDER docs) |
| 95 | +endif() |
| 96 | + |
| 97 | +#################################################### |
| 98 | +# group top level blt health checks into blt folder |
| 99 | +#################################################### |
| 100 | +if(TARGET check) |
| 101 | + blt_set_target_folder( TARGET check FOLDER blt) |
| 102 | +endif() |
| 103 | + |
| 104 | +if(TARGET style) |
| 105 | + blt_set_target_folder( TARGET style FOLDER blt) |
| 106 | +endif() |
0 commit comments