From 3ea394445aa90de2a1f5a739e05574cce783ae95 Mon Sep 17 00:00:00 2001 From: Antoine Regimbeau <antoine.regimbeau@c-s.fr> Date: Tue, 9 Jul 2019 15:26:19 +0200 Subject: [PATCH] Future work, improve the way otb check for flags and various compilation stuff --- CMake/OTBSetStandardCompilerFlags.cmake | 8 ++++++++ CMake/OTB_CheckCCompilerFlag.cmake | 2 ++ CMake/OTB_CheckCXXCompilerFlag.cmake | 2 ++ 3 files changed, 12 insertions(+) diff --git a/CMake/OTBSetStandardCompilerFlags.cmake b/CMake/OTBSetStandardCompilerFlags.cmake index 6a7cad037a..a9f4e19d67 100644 --- a/CMake/OTBSetStandardCompilerFlags.cmake +++ b/CMake/OTBSetStandardCompilerFlags.cmake @@ -57,6 +57,8 @@ function(check_c_compiler_warning_flags c_flag_var) set(local_c_flags "") set(flag_list "${ARGN}") foreach(flag IN LISTS flag_list) +# This could be replaced by a simple check_c_compiler_flag(<flag> <var>) +# https://cmake.org/cmake/help/v3.10/module/CheckCCompilerFlag.html?highlight=flags OTB_CHECK_C_COMPILER_FLAG(${flag} C_HAS_WARNING${flag}) if(${C_HAS_WARNING${flag}}) set(local_c_flags "${local_c_flags} ${flag}") @@ -70,6 +72,8 @@ function(check_cxx_compiler_warning_flags cxx_flag_var) set(local_cxx_flags "") set(flag_list "${ARGN}") foreach(flag IN LISTS flag_list) +# This could be replaced by a simple check_cxx_compiler_flag(<flag> <var>) +# https://cmake.org/cmake/help/v3.10/module/CheckCXXCompilerFlag.html?highlight=checkcxxcompilerflag OTB_CHECK_CXX_COMPILER_FLAG(${flag} CXX_HAS_WARNING${flag}) if(${CXX_HAS_WARNING${flag}}) set(local_cxx_flags "${local_cxx_flags} ${flag}") @@ -215,6 +219,8 @@ macro(check_compiler_platform_flags) # BUILD_SHARED_LIBS works as it would on other systems if(NOT CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS) if(BUILD_SHARED_LIBS) + # TODO: + # OTB_LIBRARY_BUILD_TYPE is never used! set(OTB_LIBRARY_BUILD_TYPE "SHARED") else() set(OTB_LIBRARY_BUILD_TYPE "STATIC") @@ -295,6 +301,8 @@ macro(check_compiler_platform_flags) if(OTB_USE_SSE_FLAGS) message(STATUS "SIMD extensions requested with OTB_USE_SSE_FLAGS=${OTB_USE_SSE_FLAGS}") include(OTBCheckSSEFeatures) +# This should be deleted as it can be done with cmake_host_system_information +# https://cmake.org/cmake/help/v3.10/command/cmake_host_system_information.html?highlight=sse check_sse_features(OTB_SSE_FLAGS) if(OTB_SSE_FLAGS) message(STATUS "Adding '${OTB_SSE_FLAGS}' to OTB_REQUIRED_CXX_FLAGS") diff --git a/CMake/OTB_CheckCCompilerFlag.cmake b/CMake/OTB_CheckCCompilerFlag.cmake index 3cb2064236..246cbcf258 100644 --- a/CMake/OTB_CheckCCompilerFlag.cmake +++ b/CMake/OTB_CheckCCompilerFlag.cmake @@ -22,6 +22,8 @@ include(CheckCSourceCompiles) +# This could be replaced by a simple check_c_compiler_flag(<flag> <var>) +# https://cmake.org/cmake/help/v3.10/module/CheckCCompilerFlag.html?highlight=flags macro (OTB_CHECK_C_COMPILER_FLAG _FLAG _RESULT) set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") diff --git a/CMake/OTB_CheckCXXCompilerFlag.cmake b/CMake/OTB_CheckCXXCompilerFlag.cmake index d7eb1260a1..26114bd0f2 100644 --- a/CMake/OTB_CheckCXXCompilerFlag.cmake +++ b/CMake/OTB_CheckCXXCompilerFlag.cmake @@ -42,6 +42,8 @@ include(CheckCXXSourceCompiles) +# This could be replaced by a simple check_cxx_compiler_flag(<flag> <var>) +# https://cmake.org/cmake/help/v3.10/module/CheckCXXCompilerFlag.html?highlight=checkcxxcompilerflag macro (OTB_CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") -- GitLab