You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

cmake_minimum_required(VERSION 3.9)
2 years ago
# Make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
# Disallow in-source builds
if(${srcdir} STREQUAL ${bindir})
message(FATAL_ERROR "In-source builds are not allowed."
" Please create a directory and run cmake from there, passing the path"
" to this source directory as the last argument. This process created"
" the file `CMakeCache.txt' and the directory `CMakeFiles' in ${srcdir}."
" Please remove them.")
endif()
set(STATIC_ANALYZER OFF CACHE BOOL "Using GCC static analyzer if available")
project(odm C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
2 years ago
include_directories(include GSW-C)
add_compile_options(-Wall)
2 years ago
# Dwarf-4 support check
include(CheckCXXCompilerFlag)
2 years ago
CHECK_CXX_COMPILER_FLAG(-gdwarf-4 COMPILER_SUPPORTS_DWARF4)
if(COMPILER_SUPPORTS_DWARF4 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
add_compile_options(-gdwarf-4)
2 years ago
endif()
# GCC static analyzer support check
CHECK_CXX_COMPILER_FLAG(-fanalyzer COMPILER_SUPPORTS_ANALYZER)
if(COMPILER_SUPPORTS_ANALYZER AND STATIC_ANALYZER)
add_compile_options(-fanalyzer)
endif()
add_library(teos STATIC GSW-C/gsw_oceanographic_toolbox.c GSW-C/gsw_saar.c)
set_target_properties(teos PROPERTIES LINKER_LANGUAGE C)
2 years ago
add_subdirectory(src)