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.
34 lines
1.2 KiB
34 lines
1.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() |
|
|
|
project(odm C CXX) |
|
set(CMAKE_CXX_STANDARD 20) |
|
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) |
|
|
|
include_directories(include GSW-C) |
|
add_compile_options(-Wall) |
|
|
|
# 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() |
|
|
|
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)
|
|
|