Hi Andreas,

Andreas Metzler schrieb am Sonntag, 24. Oktober 2021 um 08:47:07 UTC+2:

>
> afaiu the rc files (resource files) are a windows thingy, i.e. this 
> should be changed: 
>
> 8X--------------------------------- 
> --- libpano13-2.9.21~rc1+dfsg.orig/CMakeLists.txt 
> +++ libpano13-2.9.21~rc1+dfsg/CMakeLists.txt 
> @@ -284,13 +284,13 @@ ENDIF() 
>

This should not be necessary. CMake should be capable to figure out this 
for itself.
Nevertheless I have include this in the attached patch.
I added all your proposed changes to the patch and added a test if -lm is 
needed (I still understand why this was not necessary in libpano 13 2.9.20 
from April.). 
Could you please test, if this fixes your issues?
Also when somebody could test the patch, that nothing other is broken, this 
would be appreciated.

Thomas

-- 
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 hugin-ptx+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/e7f32b4a-c21c-4674-b782-4c8f7dcfd8b0n%40googlegroups.com.
diff -r ac7932640266 CMakeLists.txt
--- a/CMakeLists.txt	Sat Oct 16 19:04:54 2021 +0100
+++ b/CMakeLists.txt	Mon Oct 25 17:31:47 2021 +0200
@@ -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,25 @@
 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
 INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
 
-set(_common_libs ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
+# check if libm needs additional linker flag
+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)
@@ -284,15 +293,15 @@
 
 if(NOT WIN32)
   # Create and install shared library on non-windows
-  add_library(pano13 SHARED ${pano13_hdr} ${pano13_res} ${pano13_src})
+  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_res} ${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 +312,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()
@@ -401,7 +410,7 @@
 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)
+install(FILES "${CMAKE_BINARY_DIR}/libpano13.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT libraries)
 
 set(CPACK_PACKAGE_VERSION_MAJOR "${PANO_MAJOR_VERSION}")
 set(CPACK_PACKAGE_VERSION_MINOR "${PANO_MINOR_VERSION}")
@@ -587,7 +596,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

Reply via email to