The UFZ services GitLab and Mattermost will be unavailable on Monday, July 4 from 06:00 AM to 08:00 AM due to maintenance work.

compileoptions.cmake 2.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
# The variable "CMAKE_BUILD_MODULE_SYSTEM_INDEPENDENT" can be set before executing cmake via a cache command:
# $cmake -DCMAKE_BUILD_MODULE_SYSTEM_INDEPENDENT:STRING=ON ..
# or cache file:
# $cmake -C ../CMakeCacheFiles/eve ..
# or after executing CMake editing the CMakeCache.txt, preferably with a corresponding cmake editor i.e ccmake
set(CMAKE_BUILD_MODULE_SYSTEM_INDEPENDENT OFF CACHE STRING "build the module INDEPENDENT of the module system, so the build in the build tree works even after a module purge")
message(STATUS "build INDEPENDENT of module system ${CMAKE_BUILD_MODULE_SYSTEM_INDEPENDENT}")

# set specific place where to search for the netCDF directory
set(CMAKE_NETCDF_DIR " " CACHE STRING "set set specific place where to search for the netCDF directory")
Sebastian Müller's avatar
Sebastian Müller committed
11
message(STATUS "search in additional directory '${CMAKE_NETCDF_DIR}' for netCDF")
12
13
14
15
16

# The variable "CMAKE_WITH_MPI" can be set before executing cmake via a cache command:
# $cmake -DCMAKE_WITH_MPI:STRING=ON ..
# or in a cache file:
# $cmake -C ../CMakeCacheFiles/example
Sebastian Müller's avatar
Sebastian Müller committed
17
18
19
# or after executing CMake editing the CMakeCache.txt,
# preferably with a corresponding cmake editor i.e. ccmake
# same with OpenMP, lapack, coverage
20
21
22
23
24
25
26
set(CMAKE_WITH_MPI OFF CACHE STRING "build the module with MPI, so it can be executed using mpirun")
set(CMAKE_WITH_OpenMP OFF CACHE STRING "build the module with OpenMP parallelization")
set(CMAKE_WITH_LAPACK OFF CACHE STRING "build the module with lapack library")
set(CMAKE_WITH_COVERAGE OFF CACHE STRING "build the module with gcov coverage support")

# if cmake provides a findLIBRARY module, this gets invoked via find_package(LIBRARY)
if (CMAKE_WITH_MPI)
Sebastian Müller's avatar
Sebastian Müller committed
27
28
29
30
31
32
33
34
  # find if there is an MPI setup on the system and if so, set corresponding variables
  find_package(MPI)
  if (NOT ${MPI_Fortran_FOUND})
    message(FATAL_ERROR "MPI required but not found")
  else()
    message(STATUS "found MPI_Fortran_COMPILER ${MPI_Fortran_COMPILER}")
  endif()
	add_compile_definitions(MPI)
35
36
37
38
39
40
41
42
43
44
45
46
endif()

if (CMAKE_WITH_OpenMP)
	# find if there is an OpenMP setup on the system and if so, set corresponding variables
        find_package(OpenMP)
	if (NOT ${OpenMP_Fortran_FOUND})
		message(FATAL_ERROR "OpenMP required but not found")
	endif()
endif()

if (CMAKE_WITH_LAPACK)
	# find if there is an LAPACK library on the system and if so, set corresponding variables
Sebastian Müller's avatar
Sebastian Müller committed
47
  find_package(LAPACK)
48
49
50
51
	if (NOT ${LAPACK_FOUND})
		message(FATAL_ERROR "lapack required but not found")
	endif()
endif()