[Kst] branches/work/kst/portto4/kst/cmake/modules

Peter Kümmel syntheticpp at gmx.net
Sun Feb 13 13:39:53 CET 2011


SVN commit 1220242 by kuemmel:

find 3rd party libs on mac

 M  +4 -2      FindCFITSIO.cmake  
 M  +27 -30    FindGetdata.cmake  
 M  +28 -22    FindGsl.cmake  
 M  +4 -2      FindNetcdf.cmake  


--- branches/work/kst/portto4/kst/cmake/modules/FindCFITSIO.cmake #1220241:1220242
@@ -24,15 +24,17 @@
 #message(STATUS "CFITSIO: ${CFITSIO_INCLUDEDIR}")
 #message(STATUS "CFITSIO: ${CFITSIO_LIBRARIES}")
 IF(CFITSIO_INCLUDEDIR AND CFITSIO_LIBRARIES)
-	MESSAGE(STATUS "CFITSIO found at ${CFITSIO_INCLUDEDIR}")
 	SET(CFITSIO_INCLUDE_DIR ${CFITSIO_INCLUDEDIR} ${CFITSIO_INCLUDEDIR}/..)
     if (UNIX)
 		SET(CFITSIO_LIBRARIES ${CFITSIO_LIBRARIES} m)
 	endif()
 	SET(CFITSIO 1)
 	SET(cfitsio 1)
+	message(STATUS "Found CFITSIO:")
+	message(STATUS "     includes : ${CFITSIO_INCLUDE_DIR}")
+	message(STATUS "     libraries: ${CFITSIO_LIBRARIES}")
 ELSE()
-	MESSAGE(STATUS "CFITSIO not found.")
+	MESSAGE(STATUS "Not found: CFITSIO")
 ENDIF()
 
 
--- branches/work/kst/portto4/kst/cmake/modules/FindGetdata.cmake #1220241:1220242
@@ -1,54 +1,51 @@
 
 include(FindPkgConfig)
 
-pkg_check_modules(GETDATA QUIET getdata>=0.6.0)
-#message(STATUS "GD inc: ${GETDATA_INCLUDEDIR}")
-#message(STATUS "GD libs: ${GETDATA_LIBRARIES}")
+pkg_check_modules(PKGGETDATA QUIET getdata>=0.6.0)
+#message(STATUS "GD inc: ${PKGGETDATA_INCLUDEDIR}")
+#message(STATUS "GD libs: ${PKGGETDATA_LIBRARIES}")
 
+
+# Apple: install getdata with --prefix /opt/local
+
 # FIXME: GETDATA_INCLUDEDIR AND GETDATA_LIBRARIES are set by pkg_check_modules, but
 # GETDATA_LIBRARY_C and GETDATA_LIBRARY_CPP are not.
 # Ubuntu: maybe /usr/local/lib/pkgconfig/getdata.pc is not correct
-if(GETDATA_LIBRARIES AND NOT GETDATA_LIBRARY_CPP)
-	set(GETDATA_LIBRARY_C ${GETDATA_LIBRARIES})
-	set(GETDATA_LIBRARY_CPP ${GETDATA_LIBRARIES}++)
+#if(NOT PKGGETDATA_LIBRARIES)
+	set(PKGGETDATA_LIBRARIES getdata getdata++)
+    if (UNIX)
+		SET(PKGGETDATA_LIBRARIES ${PKGGETDATA_LIBRARIES} m)
 endif()
+#endif()
 
 
-if(NOT GETDATA_INCLUDEDIR AND NOT GETDATA_LIBRARIES)
 	set(GETDATA_INCLUDEDIR GETDATA_INCLUDEDIR-NOTFOUND CACHE STRING "" FORCE)
 	FIND_PATH(GETDATA_INCLUDEDIR getdata.h
 		HINTS
 		ENV GETDATA_DIR
 		PATH_SUFFIXES include/getdata include
-		PATHS ${kst_3rdparty_dir}
-		)
-	FIND_LIBRARY(GETDATA_LIBRARY_C getdata 
+	PATHS ${kst_3rdparty_dir} ${GETDATA_INCLUDEDIR})
+
+foreach(it ${PKGGETDATA_LIBRARIES})
+	set(lib lib-NOTFOUND CACHE STRING "" FORCE)
+	FIND_LIBRARY(lib ${it} 
 		HINTS
-		ENV GETDATA_DIR
+		ENV GSL_DIR
 		PATH_SUFFIXES lib
-		PATHS ${kst_3rdparty_dir}
-		)
-	FIND_LIBRARY(GETDATA_LIBRARY_CPP getdata++
-		HINTS
-		ENV GETDATA_DIR
-		PATH_SUFFIXES lib
-		PATHS ${kst_3rdparty_dir}
-		)
-endif()
+		PATHS ${kst_3rdparty_dir} ${PKGGETDATA_LIBRARY_DIRS})
+	list(APPEND GETDATA_LIBRARIES ${lib})
+endforeach()
 
-#message(STATUS "GD: ${GETDATA_INCLUDEDIR}")
-#message(STATUS "GD lib c: ${GETDATA_LIBRARY_C}")
-#message(STATUS "GD lib c++: ${GETDATA_LIBRARY_CPP}")
-IF(GETDATA_LIBRARY_C AND GETDATA_LIBRARY_CPP AND GETDATA_INCLUDEDIR)
-	MESSAGE(STATUS "Getdata found at ${GETDATA_INCLUDEDIR}")
-    SET(GETDATA_LIBRARIES ${GETDATA_LIBRARY_CPP} ${GETDATA_LIBRARY_C})
+
+
+IF(GETDATA_INCLUDEDIR AND GETDATA_INCLUDEDIR)
 	SET(GETDATA_INCLUDE_DIR ${GETDATA_INCLUDEDIR})
-    if (UNIX)
-		SET(GETDATA_LIBRARIES ${GETDATA_LIBRARIES} m)
-	endif()
 	SET(getdata 1)
+	message(STATUS "Found GetData:")
+	message(STATUS "     includes : ${GETDATA_INCLUDE_DIR}")
+	message(STATUS "     libraries: ${GETDATA_LIBRARIES}")
 ELSE()
-	MESSAGE(STATUS "Getdata not found.")
+	MESSAGE(STATUS "Not found: Getdata")
 ENDIF()
 
 
--- branches/work/kst/portto4/kst/cmake/modules/FindGsl.cmake #1220241:1220242
@@ -1,38 +1,44 @@
 
+# use pkg to find the library name and pathes,
+# but use this iformation in find_* only
+
 include(FindPkgConfig)
+pkg_check_modules(PKGGSL QUIET gsl)
 
-pkg_check_modules(GSL QUIET gsl)
+if(NOT PKGGSL_LIBRARIES)
+	set(PKGGSL_LIBRARIES gsl)
+    if (UNIX)
+		set(PKGGSL_LIBRARIES ${PKGGSL_LIBRARIES} m)
+	endif()
+endif()
 
-if(GSL_INCLUDEDIR AND GSL_LIBRARIES)
-	set(GSL_LIBRARY -L${GSL_LIBRARY_DIRS} ${GSL_LIBRARIES})
-else()
 	set(GSL_INCLUDEDIR GSL_INCLUDEDIR-NOTFOUND CACHE STRING "" FORCE)
-	FIND_PATH(GSL_INCLUDEDIR gsl_version.h
+find_path(GSL_INCLUDEDIR gsl_version.h
 		HINTS
 		ENV GSL_DIR
 		PATH_SUFFIXES include/gsl include
-		PATHS ${kst_3rdparty_dir}
-		)
-	FIND_LIBRARY(GSL_LIBRARIES gsl 
+	PATHS ${kst_3rdparty_dir} ${PKGGSL_INCLUDEDIR})
+
+foreach(it ${PKGGSL_LIBRARIES})
+	set(lib lib-NOTFOUND CACHE STRING "" FORCE)
+	FIND_LIBRARY(lib ${it} 
 		HINTS
 		ENV GSL_DIR
 		PATH_SUFFIXES lib
-		PATHS ${kst_3rdparty_dir}
-		)
-endif()
+		PATHS ${kst_3rdparty_dir} ${PKGGSL_LIBRARY_DIRS})
+	list(APPEND GSL_LIBRARIES ${lib})
+endforeach()
 
-#message(STATUS "GSL: ${GSL_INCLUDEDIR}")
-#message(STATUS "GSL: ${GSL_LIBRARIES}")
-IF(GSL_INCLUDEDIR AND GSL_LIBRARIES)
-	MESSAGE(STATUS "Gsl found at ${GSL_INCLUDEDIR}")
-	SET(GSL_INCLUDE_DIR ${GSL_INCLUDEDIR} ${GSL_INCLUDEDIR}/..)
-    if (UNIX)
-		SET(GSL_LIBRARIES ${GSL_LIBRARIES} m)
+
+if(GSL_INCLUDEDIR AND GSL_LIBRARIES)
+	set(GSL_INCLUDE_DIR ${GSL_INCLUDEDIR} ${GSL_INCLUDEDIR}/..)
+	set(gsl 1)
+	message(STATUS "Found Gsl:")
+	message(STATUS "     includes : ${GSL_INCLUDE_DIR}")
+	message(STATUS "     libraries: ${GSL_LIBRARIES}")
+else()
+	message(STATUS "Not found: Gsl")
 	endif()
-	SET(gsl 1)
-ELSE()
-	MESSAGE(STATUS "Gsl not found.")
-ENDIF()
 
 
 
--- branches/work/kst/portto4/kst/cmake/modules/FindNetcdf.cmake #1220241:1220242
@@ -50,12 +50,14 @@
 #message(STATUS "NETCDF: ${NETCDF_LIBRARY_C}")
 #message(STATUS "NETCDF: ${NETCDF_LIBRARY_CPP}")
 IF(NETCDF_INCLUDEDIR AND NETCDF_LIBRARY_C AND NETCDF_LIBRARY_CPP)
-	MESSAGE(STATUS "Netcdf found at ${NETCDF_INCLUDEDIR}")
     SET(NETCDF_LIBRARIES ${NETCDF_LIBRARY_CPP} ${NETCDF_LIBRARY_C})
 	SET(NETCDF_INCLUDE_DIR ${NETCDF_INCLUDEDIR})
 	SET(netcdf 1)
+	message(STATUS "Found NetCDF:")
+	message(STATUS "     includes : ${NETCDF_INCLUDE_DIR}")
+	message(STATUS "     libraries: ${NETCDF_LIBRARIES}")
 ELSE()
-	MESSAGE(STATUS "Netcdf not found.")
+	MESSAGE(STATUS "Not found: NetCDF")
 ENDIF()
 
 


More information about the Kst mailing list