Skip to content
Snippets Groups Projects

CMake: Improvements from kitware

Merged Mathieu Westphal requested to merge b383306/libcdi:kitware_cmake_fixes into develop
1 unresolved thread
1 file
+ 9
6
Compare changes
  • Side-by-side
  • Inline
+ 12
6
@@ -7,7 +7,6 @@ set(CMAKE_C_STANDARD 11)
include(CTest)
include(CheckIncludeFile)
# Finding libraries
### -------------- Pthread ---------------------------
@@ -17,6 +16,7 @@ if(${CDI_PTHREAD})
find_package(Threads REQUIRED)
set_target_properties(Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE)
list(APPEND cdi_compile_defs HAVE_PTHREAD=1)
list(APPEND cdi_linked_libs pthread)
endif()
# enable default internal libs
@@ -45,7 +45,6 @@ if(${CDI_SERVICE})
list(APPEND cdi_compile_defs HAVE_LIBSERVICE=1)
endif()
# ecCodes
option(CDI_ECCODES "Use the eccodes library [default=ON]" ON)
if(${CDI_ECCODES} OR eccodes_ROOT)
@@ -53,6 +52,7 @@ if(${CDI_ECCODES} OR eccodes_ROOT)
if (${eccodes_FOUND})
list(APPEND cdi_compile_defs HAVE_LIBGRIB_API=${eccodes_FOUND})
message(VERBOSE "added compile definition HAVE_LIBGRIB_API=${eccodes_FOUND}")
list(APPEND cdi_linked_libs eccodes)
else()
message(WARNING "eccodes not found, compiling without eccodes")
endif ()
@@ -70,6 +70,7 @@ if(${CDI_NETCDF} OR netCDF_ROOT )
HAVE_LIBGRIB_API=${netCDF_FOUND}
HAVE_LIBGRIB=${netCDF_FOUND}
)
list(APPEND cdi_linked_libs netCDF::netcdf)
else()
message(WARNING "netcdf target not found, compiling without netcdf")
endif ()
@@ -82,8 +83,13 @@ message(VERBOSE "looking for config.h in: ${PROJECT_BINARY_DIR}/src")
list(APPEND cdi_compile_defs CDI=1 CDI_SIZE_TYPE=size_t PACKAGE_NAME="${PROJECT_NAME}" VERSION="${CMAKE_PROJECT_VERSION}")
add_subdirectory(src)
#tests
add_subdirectory(app)
add_subdirectory(tests)
#app
option(CDI_BUILD_APP "Build the app" ON)
if (CDI_BUILD_APP)
add_subdirectory(app)
endif ()
#tests
if (BUILD_TESTING)
add_subdirectory(tests)
endif ()
Loading