File: CMakeLists.txt

package info (click to toggle)
nifticlib 3.0.1-9.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,640 kB
  • sloc: ansic: 31,214; sh: 941; makefile: 460; csh: 138; python: 88; tcl: 42
file content (32 lines) | stat: -rw-r--r-- 1,173 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
project(PARENTDEMO
        VERSION 0.0.0.1
        DESCRIPTION "A demonstration of how to incorporate nifti as a dependency"
        LANGUAGES C)

# Try to find a system version of nifti
find_package(NIFTI 3)
if(NOT NIFTI_FOUND)
  set(DOWNLOAD_TEST_DATA OFF)
  include(FetchContent)
  FetchContent_Declare( nifti_clib
          GIT_REPOSITORY https://github.com/NIFTI-Imaging/nifti_clib.git
          GIT_TAG        master # or v3.0.0, or <HASH>
          )
  if("${CMAKE_VERSION}" VERSION_LESS_EQUAL "3.14")
    FetchContent_GetProperties(nifti_clib)
    if(NOT nifti_clib_POPULATED)
      set(FETCHCONTENT_QUIET OFF)
      message(STATUS "Downloading nifti_clib from github ... please wait")
      FetchContent_Populate( nifti_clib )
      message(STATUS "download complete.")
      add_subdirectory(${nifti_clib_SOURCE_DIR} ${nifti_clib_BINARY_DIR})
    endif()
  else()
    FetchContent_MakeAvailable(nifti_clib)
  endif()
endif()

#  Example of linking project executables against nifti_clib defined targets
add_executable(parent_exe src/parent_project_exe.c)
target_link_libraries(parent_exe PRIVATE NIFTI::nifticdf)