Skip to content
Snippets Groups Projects
Unverified Commit 8a55ee3a authored by mpuchner's avatar mpuchner Committed by GitHub
Browse files

Merge pull request #1139 from mpuchner/CMake_corrections

CMake corrections
parents b09536c4 4a6ec719
No related branches found
No related tags found
No related merge requests found
......@@ -120,7 +120,7 @@ add_subdirectory(Fit/Test/Minimizer)
## recurse into the given subdirectories
# BornAgain components are build as separate shared libraries
# BornAgain components are built as separate shared libraries
set(CoreComponents "Base;Param;Sample;Device;Core")
set(AllComponents "${CoreComponents};GUI")
......
......@@ -8,7 +8,7 @@ find_package(Threads REQUIRED)
find_package(FFTW3 REQUIRED)
find_package(GSL REQUIRED)
message(STATUS "GSL found=${GSL_FOUND} libs=${GSL_LIBRARIES} inc=${GSL_INCLUDE_DIR} version={GSL_VERSION}")
message(STATUS "GSL found=${GSL_FOUND} libs=${GSL_LIBRARIES} inc=${GSL_INCLUDE_DIR} version=${GSL_VERSION}")
if(WIN32)
set(EIGEN3_INCLUDE_DIR ${CMAKE_INCLUDE_PATH})
......@@ -152,7 +152,7 @@ if(WIN32)
set(DLL "${DIR}/cerfcpp.dll")
if (NOT EXISTS ${DLL})
message(FATAL_ERROR "Dynamic load library ${DLL} (needed for cerf) does not exist")
message(FATAL_ERROR "Dynamic link library ${DLL} (needed for cerf) does not exist")
endif()
install(FILES ${DLL} DESTINATION ${destination_lib} COMPONENT Libraries)
message(STATUS "Cerf dll: ${DLL} - installed in ${destination_lib}")
......@@ -161,7 +161,7 @@ if(WIN32)
foreach(LIB IN LISTS FFTW3_LIBRARIES TIFF_LIBRARIES)
string(REPLACE ".lib" ".dll" DLL "${LIB}")
if (NOT EXISTS ${DLL})
message(FATAL_ERROR "Dynamic load library ${DLL} (derived from ${LIB}) does not exist")
message(FATAL_ERROR "Dynamic link library ${DLL} (derived from ${LIB}) does not exist")
endif()
install(FILES ${DLL} DESTINATION ${destination_lib} COMPONENT Libraries)
string(APPEND DLL_MSG " ${DLL}")
......
......@@ -28,7 +28,7 @@ function(SwigLib name lib TMP_DIR)
# Run Swig.
# Please keep -Werror, in order not to overlook critical warnings.
# Dispensable warnings are disabled in Wrap/swig/warnigs.i.
# Dispensable warnings are disabled in Wrap/swig/warnings.i.
# Joachim, oct20.
set(SWIG_FLAGS "-c++;-python;-Werror;-o;${AUTO_DIR}/lib${lib}_wrap.cpp;-outdir;${TMP_DIR}"
";-I${CMAKE_SOURCE_DIR};-I${CMAKE_BINARY_DIR}/inc")
......
......@@ -32,32 +32,50 @@ find_package_handle_standard_args(Cerf
REQUIRED_VARS Cerf_LIBRARIES Cerf_INCLUDE_DIR
VERSION_VAR Cerf_VERSION)
if(NOT Cerf_FOUND)
# If CERF was found, then either it has been found because the C version is present and was freshly
# found, or because the variables have been found in the cache (which then can be because of
# a formerly found C or C++ version)
# If not found at this point, the C version has not been found and no cache variables exist
# => Search for the C++ version
if(Cerf_FOUND)
# Either we freshly found the C version, which also means Cerf_IS_CPP is not present in the
# cache and we set it. Or we found any formerly found version (C or C++) from the cache, then
# Cerf_IS_CPP is also already in the cache and will not be changed by the following command
set(Cerf_IS_CPP OFF CACHE BOOL "Define whether CERF shall be used as C++")
else()
# C version not found and cache is empty => search for C++ version
unset(Cerf_FOUND)
unset(Cerf_LIBRARIES)
find_library(Cerf_LIBRARIES NAMES cerfcpp)
find_package_handle_standard_args(Cerf
REQUIRED_VARS Cerf_LIBRARIES Cerf_INCLUDE_DIR
VERSION_VAR Cerf_VERSION)
if(NOT Cerf_FOUND)
message(STATUS "libcerf: FOUND=${Cerf_FOUND}, VERSION=${Cerf_VERSION}, "
"LIB=${Cerf_LIBRARIES}, IS_CPP=${Cerf_IS_CPP}")
if(${Cerf_ULTIMATELY_REQUIRED})
message(FATAL_ERROR "Found neither libcerf nor libcerfcpp")
endif()
message(STATUS "Found neither libcerf nor libcerfcpp")
return()
endif()
message(STATUS "Found libcerf, language=CPP, version=${Cerf_VERSION}, lib=${Cerf_LIBRARIES},"
if(Cerf_FOUND)
set(Cerf_IS_CPP ON CACHE BOOL "Define whether CERF shall be used as C++")
endif()
endif()
# If still not found, then check whether it is ultimately required or not.
if(NOT Cerf_FOUND)
message(STATUS "libcerf: FOUND=${Cerf_FOUND}, VERSION=${Cerf_VERSION}, "
"LIB=${Cerf_LIBRARIES}, IS_CPP=${Cerf_IS_CPP}")
if(${Cerf_ULTIMATELY_REQUIRED})
message(FATAL_ERROR "Found neither C nor C++ version of cerf")
endif()
message(STATUS "Found neither C nor C++ version of cerf")
return()
endif()
if(Cerf_IS_CPP)
message(STATUS "Found libcerf, language=CPP, version=${Cerf_VERSION}, lib=${Cerf_LIBRARIES},"
" include_dir=${Cerf_INCLUDE_DIR}.")
set(Cerf_IS_CPP ON)
else()
message(STATUS "Found libcerf, language=C, version=${Cerf_VERSION}, lib=${Cerf_LIBRARIES},"
" include_dir=${Cerf_INCLUDE_DIR}.")
set(Cerf_IS_CPP OFF)
endif()
mark_as_advanced(Cerf_INCLUDE_DIR Cerf_LIBRARIES)
mark_as_advanced(Cerf_INCLUDE_DIR Cerf_LIBRARIES Cerf_IS_CPP)
include(AssertLibraryFunction)
assert_library_function(Cerf cerf "")
......
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