Hi Andreas,
thanks for the output. I think I found the cause:
Andreas Metzler schrieb am Dienstag, 26. Oktober 2021 um 18:39:03 UTC+2:
> Policy CMP0066 is not set: Honor per-config flags in try_compile()
> source-file signature. Run "cmake --help-policy CMP0066" for policy
> details. Use the cmake_policy command to set the policy and suppress this
> warning.
>
> For compatibility with older versions of CMake, try_compile is not
> honoring
> caller config-specific compiler flags (e.g. CMAKE_C_FLAGS_DEBUG) in the
> test project.
> Call Stack (most recent call first):
> /usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake:76
> (cmake_check_source_compiles)
> CMakeLists.txt:116 (check_c_source_compiles)
> This warning is for project developers. Use -Wno-dev to suppress it.
>
I hope setting the policy fixes the issue. See attached modified patch.
A first set of the changes are already gone into the repository (default
branch). The patch is for the default branch, not the source tar ball.
--
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/hugin-ptx/f152eefa-7772-489c-a72b-796287c48fban%40googlegroups.com.
diff -r 343847e37b1f CMakeLists.txt
--- a/CMakeLists.txt Tue Oct 26 17:39:46 2021 +0200
+++ b/CMakeLists.txt Tue Oct 26 19:50:00 2021 +0200
@@ -28,8 +28,8 @@
## may need to edit the wxWidgets version number below.
##
-# require at least cmake 3.0
-cmake_minimum_required(VERSION 3.0)
+# require at least cmake 3.7
+cmake_minimum_required(VERSION 3.7)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
@@ -62,15 +62,6 @@
## global setup
project(libpano13)
-set(MYLIB "lib") # default
-if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
- get_property(USE_64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
- if(USE_64)
- include(GNUInstallDirs)
- set(MYLIB ${CMAKE_INSTALL_LIBDIR})
- endif()
-endif()
-
##
# This must come before FINDs for tiff, jpeg, png, zlib to enable
# finding the wxWidgets distributions of those packages on Windows.
@@ -119,7 +110,33 @@
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
-set(_common_libs ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
+IF(UNIX)
+ ADD_DEFINITIONS(-D__Ansi__)
+ENDIF()
+IF(MINGW AND NOT BUILD_WINGUI)
+ ADD_DEFINITIONS(/D__Ansi__)
+ENDIF()
+
+# check if libm needs additional linker flag
+cmake_policy(SET CMP0066 NEW) # take current compiler flags for test in consideration
+include(CheckCSourceCompiles)
+set(LIBM_TEST_SRC "#include <math.h>\nint main() { float f=exp(2.0); }")
+check_c_source_compiles("${LIBM_TEST_SRC}" HAVE_EXP)
+if(HAVE_EXP)
+ unset(LIBM_LIB)
+else()
+ set(SAFE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS "-lm")
+ check_c_source_compile("${LIBM_TEST_SRC}" HAVE_EXP_WITH_LIBM)
+ if(HAVE_EXP_WITH_LIBM)
+ set(LIBM_LIB "-lm")
+ else()
+ message(FATAL_ERROR "Unable to use C math library functions")
+ endif()
+ set(CMAKE_REQUIRED_FLAGS ${SAFE_REQUIRED_FLAGS})
+endif()
+
+set(_common_libs ${LIBM_LIB} ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
# Sparse or dense Levenberg Marquardt
OPTION(USE_SPARSE_LEVMAR "Use Sparse Levenberg Marquardt algorithm instead of dense Levenberg Marquardt algorithm" OFF)
@@ -143,10 +160,7 @@
ENDIF(UNIX)
ENDIF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
-IF(UNIX)
- ADD_DEFINITIONS(-D__Ansi__)
-ELSE(UNIX)
- IF(MSVC)
+IF(MSVC)
# Stop MSVC8 from bitching about the C library
ADD_DEFINITIONS(/D_CRT_SECURE_NO_DEPRECATE)
# Stop MSVC9 from bitching about possibly invalid STL usage
@@ -181,13 +195,7 @@
CACHE STRING "for MSVC" FORCE
)
ENDIF(NOT BUILD_DLL)
- ENDIF(MSVC)
- IF(MINGW)
- IF(NOT BUILD_WINGUI)
- ADD_DEFINITIONS(/D__Ansi__)
- ENDIF()
- ENDIF(MINGW)
-ENDIF(UNIX)
+ENDIF(MSVC)
##
## Here is the part that builds libpano
@@ -287,12 +295,12 @@
add_library(pano13 SHARED ${pano13_hdr} ${pano13_src})
target_link_libraries(pano13 ${_common_libs})
set_target_properties(pano13 PROPERTIES VERSION "3.0.0" SOVERSION "3")
- install(TARGETS pano13 LIBRARY DESTINATION ${MYLIB} COMPONENT libraries)
+ install(TARGETS pano13 LIBRARY COMPONENT libraries)
set(_pano_target pano13)
#create and install static library
add_library(pano13a STATIC ${pano13_hdr} ${pano13_src})
set_target_properties(pano13a PROPERTIES OUTPUT_NAME pano13)
- install(TARGETS pano13a ARCHIVE DESTINATION ${MYLIB} COMPONENT libraries)
+ install(TARGETS pano13a ARCHIVE COMPONENT libraries)
else()
IF(BUILD_DLL)
# Create and install shared library
@@ -303,11 +311,11 @@
IF(MINGW)
set_target_properties(pano13 PROPERTIES PREFIX "")
ENDIF()
- install(TARGETS pano13 RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT libraries)
+ install(TARGETS pano13 COMPONENT libraries)
ELSE(BUILD_DLL)
#create and install static library
add_library(pano13 STATIC ${pano13_hdr} ${pano13_res} ${pano13_src})
- install(TARGETS pano13 ARCHIVE DESTINATION ${MYLIB} COMPONENT libraries)
+ install(TARGETS pano13 COMPONENT libraries)
ENDIF(BUILD_DLL)
set(_pano_target pano13)
endif()
@@ -406,7 +414,11 @@
set(LIB_PNG ${PNG_LIBRARY})
set(VERSION ${PACKAGE_VERSION})
configure_file("${TOP_SRC_DIR}/libpano13.pc.in" "${CMAKE_BINARY_DIR}/libpano13.pc" @ONLY)
-install(FILES "${CMAKE_BINARY_DIR}/libpano13.pc" DESTINATION "${MYLIB}/pkgconfig" COMPONENT libraries)
+IF(${CMAKE_INSTALL_LIBDIR})
+ install(FILES "${CMAKE_BINARY_DIR}/libpano13.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT libraries)
+else()
+ install(FILES "${CMAKE_BINARY_DIR}/libpano13.pc" DESTINATION "lib/pkgconfig" COMPONENT libraries)
+endif()
set(CPACK_PACKAGE_VERSION_MAJOR "${PANO_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${PANO_MINOR_VERSION}")
@@ -592,7 +604,7 @@
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
- SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${MYLIB}")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
# add the automatically determined parts of the RPATH