diff --git a/CMakeLists.txt b/CMakeLists.txt index df12a45f4ab7e12c9d2abc7b7341a4fd6df373ca..4be38d46f4cf4d0cfb2e1266da8aaf9e62600361 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()