cmake_minimum_required(VERSION 2.8.5) project(gmt_makemap CXX) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE) endif() set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/" CACHE INTERNAL "Location of our custom CMake modules." FORCE) include_directories(include) set(default_options -std=gnu++11 -flto -fvisibility=hidden -Wl,--export-dynamic -Wall) add_compile_options(${default_options}) file(GLOB modules modules/*) file(GLOB extramodules extramodules/*) set(STATIC_MODULES "") foreach(ext ${modules}) if(EXISTS ${ext}/CMakeLists.txt) string(REGEX REPLACE .*/ "" modname ${ext}) option(MODULE_${modname}_BUILD "Build module ${modname}" ON) option(MODULE_${modname}_STATIC "Link module ${modname} statically in gmt_makemap" ON) mark_as_advanced(FORCE MODULE_${modname}_STATIC) if(MODULE_${modname}_BUILD) add_subdirectory(modules/${modname}) endif() endif() endforeach(ext) foreach(ext ${extramodules}) if(EXISTS ${ext}/CMakeLists.txt) string(REGEX REPLACE .*/ "" modname ${ext}) option(MODULE_${modname}_BUILD "Build module ${modname}" ON) option(MODULE_${modname}_STATIC "Link module ${modname} statically in gmt_makemap" ON) mark_as_advanced(FORCE MODULE_${modname}_STATIC) if(MODULE_${modname}_BUILD) add_subdirectory(extramodules/${modname}) endif() endif() endforeach(ext) add_subdirectory(src)