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.
67 lines
2.2 KiB
67 lines
2.2 KiB
cmake_minimum_required(VERSION 3.9) |
|
|
|
# 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() |
|
|
|
string(ASCII 27 Esc) |
|
set(ColorReset "${Esc}[m") |
|
set(ColorBold "${Esc}[1m") |
|
set(Red "${Esc}[31m") |
|
set(Green "${Esc}[32m") |
|
set(Yellow "${Esc}[33m") |
|
set(Blue "${Esc}[34m") |
|
set(Magenta "${Esc}[35m") |
|
set(Cyan "${Esc}[36m") |
|
set(White "${Esc}[37m") |
|
set(BoldRed "${Esc}[1;31m") |
|
set(BoldGreen "${Esc}[1;32m") |
|
set(BoldYellow "${Esc}[1;33m") |
|
set(BoldBlue "${Esc}[1;34m") |
|
set(BoldMagenta "${Esc}[1;35m") |
|
set(BoldCyan "${Esc}[1;36m") |
|
set(BoldWhite "${Esc}[1;37m") |
|
|
|
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) |
|
|
|
include_directories(include sources sources-add GSW-C) |
|
add_compile_options(-Wall -Wno-deprecated-declarations) |
|
|
|
# Dwarf-4 support check |
|
include(CheckCXXCompilerFlag) |
|
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) |
|
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() |
|
|
|
# Disable michlib warnings |
|
add_compile_options(-Wno-deprecated-declarations) |
|
CHECK_CXX_COMPILER_FLAG(-Wno-class-memaccess COMPILER_SUPPORTS_CLASSMEMACCESS) |
|
if(COMPILER_SUPPORTS_CLASSMEMACCESS) |
|
add_compile_options(-Wno-class-memaccess) |
|
endif() |
|
|
|
add_library(teos STATIC GSW-C/gsw_oceanographic_toolbox.c GSW-C/gsw_saar.c) |
|
set_target_properties(teos PROPERTIES LINKER_LANGUAGE C) |
|
|
|
add_subdirectory(src)
|
|
|