Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] problem with CGAL and CMAKE

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] problem with CGAL and CMAKE


Chronological Thread 
  • From: Anthony Truchet <>
  • To:
  • Subject: Re: [cgal-discuss] problem with CGAL and CMAKE
  • Date: Fri, 03 Aug 2012 12:27:08 +0200

Le 02/08/2012 17:05, Laurent Rineau (CGAL/GeometryFactory) a écrit :
Strange. Which version of of CGAL do you use?

The CGALConfig.cmake in the build directory, and the one in the installation
directory should be different. And the bug should be only in the installed
one.

Mea culpa. I've just checked again compiling my project (and the CGALConfig.cmake file) from a clean CGAL out-of-source (and not installed) build and the CGAL*_LIBRARY variables are correctly empty.

I use the version 4.0.2 by the way.

I reckon the problem is not the *value* of CGAL*_LIBRARY but the fact
that one tries to link against it explicitly somewhere...
That is equivalent. So far, when auto-linking is enabled, we have chosen to
have those variables empty.
This approach is perfectly OK with me, but is not correctly implemented yet for *installed* CGAL on Windows.
The dual approach would be[...] That sounded more complicated to
implement, and we have chosen to use empty variables.
The simple one, once fixed, will be perfect I reckon.

In case the CGAL*_LIBRARY *in the CMakeLists.txt* are empty (autolink) then the @CGAL*_LIBRARY_NAME@ will be empty in the CGALConfig.cmake for installation. This can be handled (patch attached against 4.0.2).

Let me know if I should submit them in an other way.
I've tested I on my system and they enable building my final application from an installed CGAL without any undesirable warning or errors.

--
Anthony



--- /c/Program Files/CGAL-4.0.2/cmake/modules/CGALConfig_install.cmake.in	2012-03-12 16:35:08 +0000
+++ CGAL-4.0.2/cmake/modules/CGALConfig_install.cmake.in	2012-08-03 10:18:03 +0000
@@ -39,12 +39,12 @@
 set(WITH_CGAL_Qt3     "@WITH_CGAL_Qt3@" )
 set(WITH_CGAL_Qt4     "@WITH_CGAL_Qt4@" )
 
-set(CGAL_LIBRARY         "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@/@CGAL_LIBRARY_NAME@")
-set(CGAL_CGAL_LIBRARY    "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@/@CGAL_CGAL_LIBRARY_NAME@")
-set(CGAL_Core_LIBRARY    "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@/@CGAL_Core_LIBRARY_NAME@")
-set(CGAL_ImageIO_LIBRARY "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@/@CGAL_ImageIO_LIBRARY_NAME@")
-set(CGAL_Qt3_LIBRARY     "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@/@CGAL_Qt3_LIBRARY_NAME@" )
-set(CGAL_Qt4_LIBRARY     "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@/@CGAL_Qt4_LIBRARY_NAME@" )
+set(CGAL_LIBRARY         "@CMAKE_INSTALLED_LIBRARY@")
+set(CGAL_CGAL_LIBRARY    "@CMAKE_INSTALLED_CGAL_LIBRARY@")
+set(CGAL_Core_LIBRARY    "@CMAKE_INSTALLED_Core_LIBRARY@")
+set(CGAL_ImageIO_LIBRARY "@CMAKE_INSTALLED_ImageIO_LIBRARY@")
+set(CGAL_Qt3_LIBRARY     "@CMAKE_INSTALLED_Qt3_LIBRARY@")
+set(CGAL_Qt4_LIBRARY     "@CMAKE_INSTALLED_Qt4_LIBRARY@")
 
 set(CGAL_3RD_PARTY_INCLUDE_DIRS   "@CGAL_3RD_PARTY_INCLUDE_DIRS@" )
 set(CGAL_3RD_PARTY_DEFINITIONS    "@CGAL_3RD_PARTY_DEFINITIONS@" )
--- /c/Program Files/CGAL-4.0.2/CMakeLists.txt	2012-07-04 08:41:58 +0000
+++ CGAL-4.0.2/CMakeLists.txt	2012-08-03 09:39:09 +0000
@@ -666,21 +666,26 @@
 #
 #--------------------------------------------------------------------------------------------------
 
-# Set CGAL_LIBRARY_NAME, CGAL_Qt3_LIBRARY_NAME and so on. Those variables
-# are the name of CGAL libraries, without the path. Used in the generation
+# Set CGAL_INSTALLED_LIBRARY, CGAL_INSTALLED_Qt3_LIBRARY_NAME and so on. Those variables
+# are the path and name of installed CGAL libraries. Used in the generation
 # of the installed CGALConfig.cmake
-get_filename_component(CGAL_LIBRARY_NAME "${CGAL_LIBRARY}" NAME CACHE)
-hide_variable(CGAL_LIBRARY_NAME)
-foreach(lib ${CGAL_CONFIGURED_LIBRARIES})
-  get_filename_component(CGAL_${lib}_LIBRARY_NAME "${CGAL_${lib}_LIBRARY}" NAME CACHE)
-  hide_variable(CGAL_${lib}_LIBRARY_NAME)
-endforeach()
 
 # fake to simplify loop
 set(CGAL_CGAL_LIBRARY ${CGAL_LIBRARY})
 hide_variable(CGAL_CGAL_LIBRARY)
-set(CGAL_CGAL_LIBRARY_NAME ${CGAL_LIBRARY_NAME})
-hide_variable(CGAL_CGAL_LIBRARY_NAME)
+
+foreach(lib ${CGAL_CONFIGURED_LIBRARIES} CGAL) # note the added fake 'CGAL'
+  if ("${CGAL_${lib}_LIBRARY}")
+     get_filename_component(lib_name "${CGAL_${lib}_LIBRARY}" NAME CACHE)
+     set(CGAL_INSTALLED_${lib}_LIBRARY "${CMAKE_INSTALL_PREFIX}/${CGAL_INSTALL_LIB_DIR}/${lib_name}")
+  else ("${CGAL_${lib}_LIBRARY}")
+     set(CGAL_INSTALLED_${lib}_LIBRARY "")
+  endif("${CGAL_${lib}_LIBRARY}")
+  hide_variable(CGAL_INSTALLED_${lib}_LIBRARY)
+endforeach()
+
+# set back the fake
+set(CGAL_INSTALLED_LIBRARY  ${CGAL_INSTALLED_CGAL_LIBRARY})
 
 create_CGALconfig_files()
 



Archive powered by MHonArc 2.6.18.

Top of Page