Skip to content
Snippets Groups Projects
Commit cb6dea41 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

Main CMakeLists.txt cleanup

- removed forced out of source build
- removed global setting of HAVE_NETCDF
- HAVE_NETCDF now added to list of cdo_compile_definitions
- replaced bloated property printing by cmake inbuild features
parent 4bd561da
No related branches found
No related tags found
1 merge request!312CMake Improvements and fixes
......@@ -38,9 +38,12 @@ ELSE()
ENDIF()
### -------------- proj ---------------------------
find_package(PROJ)
if(PROJ4::proj)
list(APPEND cdo_compile_defintions ${HAVE_PROJ})
option(ENABLE_PROJ "Enable projection library, use -DPROJ_ROOT for specific path" OFF)
if(ENABLE_PROJ OR PROJ_ROOT)
find_package(PROJ)
if(PROJ4::proj)
list(APPEND cdo_compile_defintions HAVE_PROJ=${PROJ_FOUND})
endif()
endif()
### -------------- fftw3 ---------------------------
......@@ -63,16 +66,10 @@ endif()
### -------------- NETCDF ---------------------------
message("Start check for netCDF4")
find_package(netCDF 4.0 REQUIRED)
set(netcdf_flag HAVE_LIBNETCDF)
if (TARGET netCDF::netcdf)
message(DEBUG "Checking for netCDF_HAS_NC4 flag equal 'yes' : flag is: ${netCDF_HAS_NC4}")
if(NOT "${netCDF_HAS_NC4}" STREQUAL "yes")
message(WARNING "NetCDF4 installation does not support nc4")
endif()
list(APPEND cdo_compile_defintions ${netcdf_flag}=${netCDF_FOUND})
list(APPEND cdo_compile_defintions HVAE_NETCDF=${netCDF_FOUND})
else()
message(WARNING "Netcdf not found, compiling without netcdf")
endif ()
......@@ -101,27 +98,8 @@ add_subdirectory( libcdi)
add_subdirectory( src )
add_subdirectory( test )
#use this to print all variables set to true
message("STATUS:")
get_property(target_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY IMPORTED_TARGETS)
foreach(_target ${target_names})
message(STATUS "${_target}")
get_target_property(_imported_location ${_target} IMPORTED_LOCATION)
get_target_property(_imported_incl_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_interface_link_lib ${_target} INTERFACE_LINK_LIBRARIES)
message(STATUS " include paths: ${_imported_incl_dirs}")
if(_imported_location)
message(STATUS " linker target: ${_imported_location}")
endif()
if(_interface_link_lib)
message(STATUS " interf_li_lib: ${_interface_link_lib}")
endif()
endforeach()
if(FALSE)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(VERBOSE "${_variableName}=${${_variableName}}")
endforeach()
if(TRUE)
cmake_print_properties(TARGETS cdo cdolib operators PROPERTIES INTERFACE_LINK_LIBRARIES LINK_LIBRARIES)
get_property(target_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY IMPORTED_TARGETS)
cmake_print_properties(TARGETS ${target_names} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES)
endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment