Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions cmake/CodaBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ macro(coda_setup_msvc_crt)
if (CONAN_PACKAGE_NAME)
# conan handles this
else()
set(STATIC_CRT OFF CACHE BOOL "use static CRT library /MT, or /MTd for Debug (/MD or /MDd if off)")
option(STATIC_CRT "use static CRT library /MT, or /MTd for Debug (/MD or /MDd if off)" OFF)
if (STATIC_CRT)
set(CODA_MSVC_RUNTIME "/MT")
else()
Expand Down Expand Up @@ -343,7 +343,7 @@ function(coda_fetch_driver)
# The returned properties use the lower-cased name
string(TOLOWER ${target_name} target_name_lc)
if (NOT ${target_name_lc}_POPULATED) # This makes sure we only fetch once.
message("Populating content for external dependency ${driver_name}")
message("Populating content for external dependency ${target_name_lc}")
# Now (at configure time) unpack the content.
FetchContent_Populate(${target_name})
# Remember where we put stuff
Expand Down Expand Up @@ -388,6 +388,8 @@ function(coda_add_tests)
"DEPS;SOURCES;ARGS;FILTER_LIST" # multi args
"${ARGN}"
)
option(${PROJECT_NAME}_AUTO_UNITTEST "run unittests during build" OFF)

if (ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "received unexpected argument(s): ${ARG_UNPARSED_ARGUMENTS}")
endif()
Expand Down Expand Up @@ -461,6 +463,18 @@ function(coda_add_tests)
RUNTIME DESTINATION "${ARG_DIRECTORY}/${ARG_MODULE_NAME}/${test_subdir}")
endif()
endforeach()

if (${ARG_UNITTEST} AND ${PROJECT_NAME}_AUTO_UNITTEST)
set (MOD ${ARG_MODULE_NAME}-${TARGET_LANGUAGE})
get_target_property(type ${MOD} TYPE)
# Can only define POST_BUILD targets on non-interface libs
if (NOT ${type} STREQUAL "INTERFACE_LIBRARY")
add_custom_command(TARGET ${MOD} POST_BUILD
COMMAND ${CMAKE_CTEST_COMMAND}
--test-dir ${CMAKE_CURRENT_BINARY_DIR} --output-on-failure
DEPENDS ${test_group_tgt})
endif()
endif()
endif()
endfunction()

Expand Down
12 changes: 7 additions & 5 deletions cmake/CodaFindSystemDependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# find and import system dependencies
macro(coda_find_system_dependencies)
# creates imported target Boost::serialization, if found
# see https://cmake.org/cmake/help/latest/module/FindBoost.html
# Nothing uses the boost flag?
option(ENABLE_BOOST "Enable building modules dependent on Boost" OFF)

option(ENABLE_PYTHON "Enable building Python modules" ON)
option(ENABLE_SWIG "Enable generation of SWIG bindings" OFF)
# creates imported target Threads::Threads
# see https://cmake.org/cmake/help/latest/module/FindThreads.html
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
Expand All @@ -9,9 +16,6 @@ macro(coda_find_system_dependencies)
# see https://cmake.org/cmake/help/latest/module/FindCURL.html
find_package(CURL)

# creates imported target Boost::serialization, if found
# see https://cmake.org/cmake/help/latest/module/FindBoost.html
set(ENABLE_BOOST OFF CACHE BOOL "Enable building modules dependent on Boost")

# sets the following variables if Python installation found:
# Python_FOUND - flag indicating system has the requested components
Expand All @@ -32,10 +36,8 @@ macro(coda_find_system_dependencies)
# Python_NumPy_INCLUDE_DIRS - NumPy include directories
#
# see https://cmake.org/cmake/help/latest/module/FindPython.html
set(ENABLE_PYTHON ON CACHE BOOL "Enable building Python modules")
set(PYTHON_VERSION "" CACHE STRING "Hint for which version of Python to find")
set(PYTHON_HOME "" CACHE PATH "Path to existing Python installation")
set(ENABLE_SWIG OFF CACHE BOOL "Enable generation of SWIG bindings")
if (PYTHON_HOME)
# specifying PYTHON_HOME implies ENABLE_PYTHON
set(ENABLE_PYTHON ON CACHE BOOL "Enable building Python modules" FORCE)
Expand Down
3 changes: 1 addition & 2 deletions modules/c++/mt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(MODULE_NAME mt)

set(MT_DEFAULT_PINNING OFF CACHE BOOL
"Use affinity-based CPU pinning by default in MT")
option(MT_DEFAULT_PINNING "Use affinity-based CPU pinning by default in MT" OFF)
coda_generate_module_config_header(${MODULE_NAME})

coda_add_module(
Expand Down
2 changes: 1 addition & 1 deletion modules/c++/re/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(MODULE_NAME re)
set(MODULE_DEPS sys-c++)

# Enable to use std::regex instead of PCRE.
set(RE_ENABLE_STD_REGEX OFF CACHE BOOL "use std::regex instead of pcre")
option(RE_ENABLE_STD_REGEX "use std::regex instead of pcre" OFF)

if (RE_ENABLE_STD_REGEX OR ENABLE_PCRE)
coda_generate_module_config_header(${MODULE_NAME})
Expand Down
19 changes: 10 additions & 9 deletions modules/drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Declare options
option(ENABLE_XML "enable XML" ON)
option(ENABLE_J2K "enable J2K library" ON)
option(ENABLE_JARS "include jars in the install" ON)
option(ENABLE_JPEG "enable use of libjpeg" ON)
option(ENABLE_PCRE "enable PCRE library" ON)
option(ENABLE_UUID "enable UUID library" ON)
option(ENABLE_ZIP "enable zlib" ON)
option(CODA_ENABLE_HDF5 "enable hdf5" ON)

# Turn off all warnings; this is code we don't control.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
Expand All @@ -13,8 +23,6 @@ endif()

#add_subdirectory("curl") # this is handled in coda_find_system_dependencies
#add_subdirectory("numpy") # this is handled in coda_find_system_dependencies

set(ENABLE_XML ON CACHE BOOL "enable XML")
if(NOT CONAN_PACKAGE_NAME)
set(XML_HOME "" CACHE PATH "path to pre-existing XML library installation")
if(ENABLE_XML OR XML_HOME)
Expand All @@ -24,28 +32,24 @@ endif()

#add_subdirectory("gsl") # nothing to do

set(ENABLE_J2K ON CACHE BOOL "enable J2K library")
if(NOT CONAN_PACKAGE_NAME)
set(J2K_HOME "" CACHE PATH "path to J2K installation")
if (ENABLE_J2K OR J2K_HOME)
add_subdirectory("j2k")
endif()
endif()

set(ENABLE_JARS ON CACHE BOOL "include jars in the install")
if (ENABLE_JARS)
add_subdirectory("jars")
endif()

set(ENABLE_JPEG ON CACHE BOOL "enable use of libjpeg")
if (NOT CONAN_PACKAGE_NAME)
set(JPEG_HOME "" CACHE PATH "path to libjpeg installation")
if (ENABLE_JPEG OR JPEG_HOME)
add_subdirectory("jpeg")
endif()
endif()

set(ENABLE_PCRE ON CACHE BOOL "enable PCRE library")
if (NOT CONAN_PACKAGE_NAME)
set(PCRE_HOME "" CACHE PATH "path to PCRE installation")
if (ENABLE_PCRE OR PCRE_HOME)
Expand All @@ -59,20 +63,17 @@ if (SQL_LAYER OR SQL_HOME)
add_subdirectory("sql")
endif()

set(ENABLE_UUID ON CACHE BOOL "enable UUID library")
if (ENABLE_UUID OR UUID_HOME)
add_subdirectory("uuid")
endif()

set(ENABLE_ZIP ON CACHE BOOL "enable zlib")
if (NOT CONAN_PACKAGE_NAME)
set(ZIP_HOME "" CACHE PATH "path to pre-existing zlib installation, if not provided zlib will be built")
if (ENABLE_ZIP OR ZIP_HOME)
add_subdirectory("zlib")
endif()
endif()

set(CODA_ENABLE_HDF5 ON CACHE BOOL "enable hdf5")
set(CODA_HDF5_HOME "" CACHE PATH "path to pre-existing HDF5 installation, if not provided HDF5 will be built")
if (CODA_ENABLE_HDF5 OR CODA_HDF5_HOME)
add_subdirectory("hdf5")
Expand Down