Dependencies.cmake 15.1 KB
Newer Older
1
2
message(STATUS "┌─ Dependencies.cmake")
list(APPEND CMAKE_MESSAGE_INDENT "│    ")
3
4
set(CMAKE_FOLDER ThirdParty)

5
# ccache, on Windows requires https://github.com/cristianadam/ccache/releases
6
7
8
9
10
11
12
13
14
15
16
if(NOT WIN32 AND CCACHE_TOOL_PATH AND NOT OGS_DISABLE_COMPILER_CACHE)
    set(CCACHE_OPTIONS "CCACHE_SLOPPINESS=pch_defines,time_macros")
    if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang|AppleClang")
        list(APPEND CCACHE_OPTIONS "CCACHE_CPP2=true")
    endif()
    CPMAddPackage(
        NAME Ccache.cmake
        GITHUB_REPOSITORY TheLartians/Ccache.cmake
        VERSION 1.2.2
        OPTIONS "USE_CCACHE ON"
    )
17
18
19
20
21
22
23
24
25
elseif(
    WIN32
    AND CCACHE_TOOL_PATH
    AND NOT OGS_DISABLE_COMPILER_CACHE
    AND "${CMAKE_GENERATOR}" STREQUAL "Ninja"
)
    set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
    set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
    message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).")
26
27
endif()

28
if(OGS_BUILD_TESTING)
Lars Bilke's avatar
Lars Bilke committed
29
30
31
    CPMAddPackage(
        NAME googletest
        GITHUB_REPOSITORY google/googletest
32
        VERSION ${ogs.minimum_version.gtest}
33
        GIT_TAG ${ogs.tested_version.gtest}
34
        OPTIONS "INSTALL_GTEST OFF" "gtest_force_shared_crt ON"
Lars Bilke's avatar
Lars Bilke committed
35
                "BUILD_SHARED_LIBS OFF"
Lars Bilke's avatar
Lars Bilke committed
36
        EXCLUDE_FROM_ALL YES
Lars Bilke's avatar
Lars Bilke committed
37
38
39
40
41
42
43
44
45
46
    )

    CPMAddPackage(
        NAME autocheck
        GITHUB_REPOSITORY ufz/autocheck
        GIT_TAG e388ecbb31c49fc2724c8d0436da313b6edca7fd
        DOWNLOAD_ONLY YES
    )
    if(autocheck_ADDED)
        add_library(autocheck INTERFACE IMPORTED)
47
48
49
        target_include_directories(
            autocheck SYSTEM INTERFACE ${autocheck_SOURCE_DIR}/include
        )
Lars Bilke's avatar
Lars Bilke committed
50
51
52
    endif()
endif()

Lars Bilke's avatar
Lars Bilke committed
53
54
55
56
57
58
59
60
61
62
63
64
65
CPMFindPackage(
    NAME spdlog
    GITHUB_REPOSITORY gabime/spdlog
    VERSION 1.10.0
    OPTIONS "BUILD_SHARED_LIBS OFF" "SPDLOG_BUILD_SHARED OFF"
)
if(spdlog_ADDED)
    set_target_properties(
        spdlog
        PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
                   $<TARGET_PROPERTY:spdlog,INTERFACE_INCLUDE_DIRECTORIES>
    )
endif()
Lars Bilke's avatar
Lars Bilke committed
66

67
CPMFindPackage(
Lars Bilke's avatar
Lars Bilke committed
68
69
    NAME tclap
    GITHUB_REPOSITORY ufz/tclap
Lars Bilke's avatar
Lars Bilke committed
70
71
    VERSION 1.2.4
    GIT_TAG 098dd0fe07a31618f3c2a9f8727bb01c8c5d61e2
Lars Bilke's avatar
Lars Bilke committed
72
73
74
75
    DOWNLOAD_ONLY YES
)
if(tclap_ADDED)
    add_library(tclap INTERFACE IMPORTED)
76
77
78
    target_include_directories(
        tclap SYSTEM INTERFACE ${tclap_SOURCE_DIR}/include
    )
Lars Bilke's avatar
Lars Bilke committed
79
80
81
endif()

CPMAddPackage(
82
    NAME tetgen GITHUB_REPOSITORY ufz/tetgen
Lars Bilke's avatar
Lars Bilke committed
83
84
85
86
    GIT_TAG 603ba181ebfaed38eec88532720e282606009b73
)
if(tetgen_ADDED)
    install(PROGRAMS $<TARGET_FILE:tetgen> DESTINATION bin)
Lars Bilke's avatar
Lars Bilke committed
87
    list(APPEND DISABLE_WARNINGS_TARGETS tet tetgen)
Lars Bilke's avatar
Lars Bilke committed
88
89
90
91
endif()

if(OGS_USE_PYTHON)
    CPMAddPackage(
92
        NAME pybind11 GITHUB_REPOSITORY pybind/pybind11
Lars Bilke's avatar
Lars Bilke committed
93
94
95
        GIT_TAG f1abf5d9159b805674197f6bc443592e631c9130
    )
endif()
96

Lars Bilke's avatar
Lars Bilke committed
97
if(_build_chemistry_lib)
98
99
100
101
102
103
104
105
    CPMAddPackage(
        NAME iphreeqc
        GITHUB_REPOSITORY ufz/iphreeqc
        GIT_TAG b1047d3eb03e7ef1b850231be35acb9c6a2cf345
        DOWNLOAD_ONLY YES
    )
    if(iphreeqc_ADDED)
        include(scripts/cmake/iphreeqc.cmake)
Lars Bilke's avatar
Lars Bilke committed
106
        list(APPEND DISABLE_WARNINGS_TARGETS iphreeqc)
107
108
    endif()
endif()
109
110
111

CPMFindPackage(
    NAME Eigen3
Lars Bilke's avatar
Lars Bilke committed
112
113
114
115
    # Error as in
    # https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/8475
    # GITLAB_REPOSITORY libeigen/eigen
    URL https://gitlab.com/libeigen/eigen/-/archive/${ogs.minimum_version.eigen}/eigen-${ogs.minimum_version.eigen}.tar.gz
116
117
118
119
120
    GIT_TAG ${ogs.minimum_version.eigen}
    DOWNLOAD_ONLY YES
)
if(Eigen3_ADDED)
    add_library(Eigen3::Eigen INTERFACE IMPORTED)
121
    target_include_directories(
122
123
        Eigen3::Eigen SYSTEM INTERFACE ${Eigen3_SOURCE_DIR}
                                       ${OpenMP_CXX_INCLUDE_DIRS}
124
    )
125
endif()
Lars Bilke's avatar
Lars Bilke committed
126

Lars Bilke's avatar
Lars Bilke committed
127
128
129
130
if(OGS_USE_MFRONT)
    CPMAddPackage(
        NAME MGIS
        GITHUB_REPOSITORY ufz/MFrontGenericInterfaceSupport
131
        GIT_TAG ff51a694957b2f1c16689962529fad0ee2b04558
132
        OPTIONS "enable-doxygen-doc OFF" "enable-fortran-bindings OFF"
Lars Bilke's avatar
Lars Bilke committed
133
        EXCLUDE_FROM_ALL YES
Lars Bilke's avatar
Lars Bilke committed
134
135
136
137
    )
    if(MGIS_ADDED)
        set_target_properties(MFrontGenericInterface PROPERTIES CXX_STANDARD 11)
        list(APPEND DISABLE_WARNINGS_TARGETS MFrontGenericInterface)
138
        set(_MFRONT_TFEL_FOUND ON CACHE INTERNAL "")
Lars Bilke's avatar
Lars Bilke committed
139
140
141
    endif()
endif()

142
143
144
CPMFindPackage(
    NAME Boost
    VERSION ${ogs.minimum_version.boost}
145
    URL https://gitlab.opengeosys.org/ogs/libs/boost-subset/-/jobs/187805/artifacts/raw/ogs-boost-${ogs.minimum_version.boost}.tar.gz
146
)
147
148
149
if(Boost_ADDED)
    add_library(Boost::boost INTERFACE IMPORTED)
    target_include_directories(Boost::boost INTERFACE "${Boost_SOURCE_DIR}")
Lars Bilke's avatar
Lars Bilke committed
150
151
else()
    target_include_directories(Boost::boost INTERFACE "${Boost_INCLUDE_DIR}")
152
endif()
153

Lars Bilke's avatar
Lars Bilke committed
154
155
156
157
CPMFindPackage(
    NAME LibXml2
    GITHUB_REPOSITORY GNOME/libxml2
    VERSION ${ogs.minimum_version.libxml2}
158
159
    OPTIONS "BUILD_SHARED_LIBS OFF"
            "LIBXML2_WITH_TESTS OFF"
Lars Bilke's avatar
Lars Bilke committed
160
161
162
163
164
165
166
167
168
169
170
            "LIBXML2_WITH_PROGRAMS OFF"
            "LIBXML2_WITH_ICONV OFF"
            "LIBXML2_WITH_ICU OFF"
            "LIBXML2_WITH_LZMA OFF"
            "LIBXML2_WITH_PYTHON OFF"
            "LIBXML2_WITH_ZLIB OFF"
    EXCLUDE_FROM_ALL YES
)
if(LibXml2_ADDED)
    add_library(LibXml2::LibXml2 ALIAS LibXml2)
    set(LIBXML2_INCLUDE_DIR ${LibXml2_SOURCE_DIR})
171
    list(APPEND DISABLE_WARNINGS_TARGETS LibXml2)
Lars Bilke's avatar
Lars Bilke committed
172
173
174
endif()

CPMAddPackage(
175
176
    NAME xmlpatch
    VERSION 0.4.2
Lars Bilke's avatar
Lars Bilke committed
177
    GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/libs/xmlpatch.git
178
    OPTIONS "BUILD_SHARED_LIBS OFF"
Lars Bilke's avatar
Lars Bilke committed
179
180
)

181
182
if(OGS_BUILD_SWMM)
    CPMAddPackage(
183
        NAME SWMMInterface GITHUB_REPOSITORY ufz/SwmmInterface
184
185
186
        GIT_TAG 141e05ae1f419918799d7bf9178ebcd97feb1ed3
    )
    if(SWMMInterface_ADDED)
187
188
189
        target_include_directories(
            SwmmInterface SYSTEM PUBLIC ${SWMMInterface_SOURCE_DIR}
        )
190
191
192
193
        list(APPEND DISABLE_WARNINGS_TARGETS SWMM SwmmInterface)
    endif()
endif()

194
CPMFindPackage(
Lars Bilke's avatar
Lars Bilke committed
195
196
    NAME nlohmann_json
    VERSION 3.6.1
197
198
    # the git repo is incredibly large, so we download the archived include
    # directory
Lars Bilke's avatar
Lars Bilke committed
199
    URL https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip
200
201
    URL_HASH
        SHA256=69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf
Lars Bilke's avatar
Lars Bilke committed
202
203
)
if(nlohmann_json_ADDED)
204
    add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
205
    target_include_directories(
206
        nlohmann_json::nlohmann_json INTERFACE ${nlohmann_json_SOURCE_DIR}
207
    )
Lars Bilke's avatar
Lars Bilke committed
208
209
endif()

Lars Bilke's avatar
Lars Bilke committed
210
211
212
213
214
215
if(OGS_BUILD_GUI)
    CPMAddPackage(
        NAME rapidxml
        VERSION 1.13
        GITHUB_REPOSITORY ufz/rapidxml
        GIT_TAG 2ae4b2888165a393dfb6382168825fddf00c27b9
Lars Bilke's avatar
Lars Bilke committed
216
        EXCLUDE_FROM_ALL YES
Lars Bilke's avatar
Lars Bilke committed
217
218
219
220
221
222
223
    )
    if(rapidxml_ADDED)
        add_library(rapidxml INTERFACE IMPORTED)
        target_include_directories(rapidxml INTERFACE ${rapidxml_SOURCE_DIR})
    endif()
endif()

Lars Bilke's avatar
Lars Bilke committed
224
if(OGS_BUILD_GUI)
225
226
227
228
229
230
231
232
233
    find_package(Shapelib QUIET)
    if(Shapelib_FOUND)
        add_library(shp INTERFACE IMPORTED)
        target_include_directories(shp INTERFACE ${Shapelib_INCLUDE_DIRS})
        target_link_libraries(shp INTERFACE ${Shapelib_LIBRARIES})
    else()
        CPMAddPackage(
            NAME Shapelib
            GITHUB_REPOSITORY OSGeo/shapelib
234
235
            VERSION 1.5.0-dev
            GIT_TAG 21ae8fc16afa15a1b723077b6cec3a9abc592f6a
236
237
            EXCLUDE_FROM_ALL YES
        )
238
239
240
        target_include_directories(
            shp INTERFACE $<BUILD_INTERFACE:${Shapelib_SOURCE_DIR}>
        )
Lars Bilke's avatar
Lars Bilke committed
241
242
243
    endif()
endif()

244
245
246
247
248
249
250
if(OGS_USE_CVODE)
    CPMAddPackage(
        NAME CVODE
        GITHUB_REPOSITORY ufz/cvode
        VERSION 2.8.2
        GIT_TAG 42d786bff4f950045d2de941677ecd4432cec855
        OPTIONS "EXAMPLES_ENABLE OFF"
Lars Bilke's avatar
Lars Bilke committed
251
        EXCLUDE_FROM_ALL YES
252
253
254
    )
    if(CVODE_ADDED)
        add_library(CVODE::CVODE INTERFACE IMPORTED)
255
256
257
        target_include_directories(
            CVODE::CVODE INTERFACE ${CVODE_SOURCE_DIR}/include
                                   ${CVODE_BINARY_DIR}/include
258
        )
259
260
261
        target_link_libraries(
            CVODE::CVODE INTERFACE sundials_cvode_static
                                   sundials_nvecserial_static
262
263
264
265
        )
    endif()
endif()

266
# VTK ###
267
268
unset(VTK_OPTIONS)
foreach(option_index ${ogs.libraries.vtk.options})
269
    if(${ogs.libraries.vtk.options_${option_index}.condition.cmake})
270
271
272
273
274
275
276
277
278
279
        foreach(cmake_index ${ogs.libraries.vtk.options_${option_index}.cmake})
            string(
                REPLACE
                    "="
                    " "
                    cmake_option
                    "${ogs.libraries.vtk.options_${option_index}.cmake_${cmake_index}}"
            )
            list(APPEND VTK_OPTIONS ${cmake_option})
        endforeach()
280
    endif()
281
endforeach()
282
list(REMOVE_DUPLICATES VTK_OPTIONS)
283

Lars Bilke's avatar
Lars Bilke committed
284
285
286
287
288
289
290
291
292
293
294
295
if(OGS_USE_INSITU)
    find_package(ParaView REQUIRED)
else()
    unset(VTK_COMPONENTS)
    foreach(opt ${VTK_OPTIONS})
        if("${opt}" MATCHES "^VTK_MODULE_ENABLE_VTK_(.*) YES")
            list(APPEND VTK_COMPONENTS ${CMAKE_MATCH_1})
        endif()
    endforeach()
    message(STATUS "FINDING VTK: ${VTK_COMPONENTS}")
    find_package(VTK ${ogs.minimum_version.vtk} COMPONENTS ${VTK_COMPONENTS})
endif()
296

Lars Bilke's avatar
Lars Bilke committed
297
if(NOT VTK_FOUND AND NOT OGS_USE_INSITU)
298
299
300
    # Setting shared libs on PETSc, otherwise pvtu files only contain one
    # <Piece>-element (one subdomain).
    list(APPEND VTK_OPTIONS "BUILD_SHARED_LIBS ${OGS_USE_PETSC}")
301
302
    if(OGS_USE_PETSC AND EXISTS ${PROJECT_BINARY_DIR}/_ext/HDF5)
        # Use local hdf5 build
303
304
305
        list(APPEND VTK_OPTIONS "VTK_MODULE_USE_EXTERNAL_VTK_hdf5 ON"
             "HDF5_ROOT ${PROJECT_BINARY_DIR}/_ext/HDF5"
        )
306
    endif()
307

308
309
310
311
312
    CPMAddPackage(
        NAME VTK
        GITHUB_REPOSITORY kitware/vtk
        VERSION ${ogs.minimum_version.vtk}
        OPTIONS ${VTK_OPTIONS}
313
        EXCLUDE_FROM_ALL YES GIT_SUBMODULES "" # Disable submodules
314
315
    )
endif()
316
if(VTK_ADDED)
317
    if(OGS_USE_PETSC)
318
        list(APPEND CMAKE_BUILD_RPATH
319
320
321
322
323
             ${PROJECT_BINARY_DIR}/_deps/vtk-build/${CMAKE_INSTALL_LIBDIR}
        )
        # to properly install vtk libs
        set(OGS_INSTALL_DEPENDENCIES ON CACHE BOOL "" FORCE)
    endif()
324
325
326
327
328
329
    if(OpenMP_FOUND AND TARGET vtkFiltersStatistics)
        target_link_libraries(vtkFiltersStatistics PRIVATE OpenMP::OpenMP_C)
    endif()
    if(TARGET loguru)
        # Fixes https://stackoverflow.com/questions/9894961 on vismac05:
        set_target_properties(loguru PROPERTIES CXX_VISIBILITY_PRESET default)
330
331
        # Also suppress warnings
        list(APPEND DISABLE_WARNINGS_TARGETS loguru)
332
    endif()
Lars Bilke's avatar
Lars Bilke committed
333
334
    # VTK already comes with exprtk, reusing it.
    target_include_directories(
335
336
337
        exprtk SYSTEM
        INTERFACE
            $<BUILD_INTERFACE:${VTK_SOURCE_DIR}/ThirdParty/exprtk/vtkexprtk>
Lars Bilke's avatar
Lars Bilke committed
338
339
340
341
342
343
344
345
346
347
348
349
350
351
    )
else()
    CPMAddPackage(
        NAME exprtk
        GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/libs/exprtk.git
        GIT_TAG 2a5c62b93c9661470e69be572f22d821308b6f61
        DOWNLOAD_ONLY YES
    )
    if(exprtk_ADDED)
        add_library(exprtk INTERFACE IMPORTED)
        target_include_directories(exprtk SYSTEM INTERFACE ${exprtk_SOURCE_DIR})
    endif()
endif()

352
353
354
355
356
357
358
359
CPMAddPackage(
    NAME range-v3
    GITHUB_REPOSITORY ericniebler/range-v3
    VERSION 0.12.0
    GIT_TAG 0.12.0
    EXCLUDE_FROM_ALL YES
)

360
if(OGS_BUILD_TESTING OR OGS_BUILD_UTILS)
361
    CPMAddPackage(
362
        NAME vtkdiff GITHUB_REPOSITORY ufz/vtkdiff
Lars Bilke's avatar
Lars Bilke committed
363
        GIT_TAG 788100291f73e472febf7e5550eea36ec4be518b
364
365
366
367
368
369
    )
    if(vtkdiff_ADDED)
        install(PROGRAMS $<TARGET_FILE:vtkdiff> DESTINATION bin)
    endif()
endif()

370
if(OGS_USE_PETSC)
Lars Bilke's avatar
Lars Bilke committed
371
    include(CheckCXXSymbolExists)
372
    set(CMAKE_REQUIRED_INCLUDES "${HDF5_INCLUDE_DIRS}")
Lars Bilke's avatar
Lars Bilke committed
373
374
375
376
377
378
379
380
381
382
383
    set(CMAKE_REQUIRED_LIBRARIES "${HDF5_LIBRARIES}")
    check_cxx_symbol_exists(H5Pset_fapl_mpio hdf5.h HAVE_H5Pset_fapl_mpio)
    unset(CMAKE_REQUIRED_INCLUDES)
    if(NOT HAVE_H5Pset_fapl_mpio)
        message(FATAL_ERROR "HDF5 was not build with MPI support! "
                            "(Enable with HDF5_ENABLE_PARALLEL)"
        )
    endif()
endif()

# Does not compile in Debug-mode, see #3175.
384
if(CMAKE_BUILD_TYPE MATCHES "Rel" AND OGS_BUILD_TESTING)
Lars Bilke's avatar
Lars Bilke committed
385
386
387
388
389
390
    set(XDMF_LIBNAME OgsXdmf CACHE STRING "")
    CPMAddPackage(
        NAME xdmf
        VERSION 3.0.0
        GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/xdmflib.git
        GIT_TAG 92a851f1acb87ad5367eb62f9b97785bedb700bb
391
        OPTIONS "XDMF_LIBNAME OgsXdmf" "CMAKE_MACOSX_RPATH ON"
392
                "HDF5_C_INCLUDE_DIR ${HDF5_INCLUDE_DIRS}"
Lars Bilke's avatar
Lars Bilke committed
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
        EXCLUDE_FROM_ALL YES
    )
    if(xdmf_ADDED)
        target_include_directories(
            OgsXdmf PUBLIC ${xdmf_SOURCE_DIR} ${xdmf_BINARY_DIR}
        )

        target_link_libraries(OgsXdmf Boost::boost)
        target_include_directories(
            OgsXdmfCore PUBLIC ${xdmf_SOURCE_DIR}/core ${xdmf_BINARY_DIR}/core
            PRIVATE ${xdmf_SOURCE_DIR}/CMake/VersionSuite
        )
        target_link_libraries(
            OgsXdmfCore PUBLIC Boost::boost LibXml2::LibXml2 ${HDF5_LIBRARIES}
        )

        set_target_properties(
            OgsXdmf OgsXdmfCore
            PROPERTIES RUNTIME_OUTPUT_DIRECTORY
                       ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
                       LIBRARY_OUTPUT_DIRECTORY
                       ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
                       ARCHIVE_OUTPUT_DIRECTORY
                       ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
        )
        if(BUILD_SHARED_LIBS)
            install(TARGETS OgsXdmf OgsXdmfCore
                    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
            )
        endif()
        list(APPEND DISABLE_WARNINGS_TARGETS OgsXdmf OgsXdmfCore)
    endif()
endif()

427
428
429
430
431
CPMAddPackage(
    NAME GroupSourcesByFolder.cmake
    GITHUB_REPOSITORY TheLartians/GroupSourcesByFolder.cmake VERSION 1.0
)

432
433
434
if(OGS_BUILD_UTILS)
    CPMAddPackage(
        NAME metis
435
436
437
        GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/libs/metis.git
        GIT_TAG 6596bee9cb316455df9ae4192df13d3ee7a73805
        VERSION 5.1.0
438
439
440
441
442
        DOWNLOAD_ONLY YES
    )
    include(${PROJECT_SOURCE_DIR}/scripts/cmake/MetisSetup.cmake)
endif()

Lars Bilke's avatar
Lars Bilke committed
443
# Disable warnings
Lars Bilke's avatar
Lars Bilke committed
444
445
446
if(WIN32 AND VTK_ADDED)
    list(APPEND DISABLE_WARNINGS_TARGETS vtksys)
endif()
Lars Bilke's avatar
Lars Bilke committed
447
foreach(target ${DISABLE_WARNINGS_TARGETS})
448
    target_compile_options(
449
450
        ${target} PRIVATE $<$<CXX_COMPILER_ID:Clang,AppleClang,GNU>:-w>
                          $<$<CXX_COMPILER_ID:MSVC>:/W0>
451
    )
Lars Bilke's avatar
Lars Bilke committed
452
endforeach()
453
454

# Hack: Disable tests from dependencies
455
456
configure_file(
    ${PROJECT_SOURCE_DIR}/scripts/cmake/test/CTestCustom.in.cmake
457
458
    ${PROJECT_BINARY_DIR}/CTestCustom.cmake @ONLY
)
Lars Bilke's avatar
Lars Bilke committed
459

460
461
462
463
464
find_program(CLANG_FORMAT_PROGRAM clang-format)
find_program(CMAKE_FORMAT_PROGRAM cmake-format)

if(CLANG_FORMAT_PROGRAM OR CMAKE_FORMAT_PROGRAM)
    if(NOT CMAKE_FORMAT_PROGRAM)
Lars Bilke's avatar
Lars Bilke committed
465
        set(_skip_cmake "FORMAT_SKIP_CMAKE YES")
466
467
    endif()
    CPMAddPackage(
468
469
470
471
472
473
        NAME Format.cmake
        VERSION 1.7.0
        GITHUB_REPOSITORY TheLartians/Format.cmake
        OPTIONS
            ${_skip_cmake}
            "CMAKE_FORMAT_EXCLUDE scripts/cmake/CPM.cmake|.*/Tests.cmake|scripts/cmake/jedbrown/.*|scripts/cmake/conan/conan.cmake|scripts/cmake/vector-of-bool/.*"
474
475
    )
endif()
476
477
478
479
480
481
482
483
484
485

# Third-party licenses
CPMAddPackage(
    NAME CPMLicenses.cmake GITHUB_REPOSITORY cpm-cmake/CPMLicenses.cmake
    VERSION 0.0.5
)
cpm_licenses_create_disclaimer_target(
    write-licenses "${PROJECT_BINARY_DIR}/third_party_licenses.txt"
    "${CPM_PACKAGES}"
)
486

487
unset(CMAKE_FOLDER)
488
489
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(STATUS "└─ End Dependencies.cmake")