[Geotiff] CMakeList.txt

David Burken dburken at comcast.net
Thu Jun 16 09:45:36 PDT 2011


Hi Everyone,

Very happy to see the addition of the CMakeList.txt to libgeotiff.  Just 
some comments.  Please I'm not picking on anyone just trying to give 
some useful feedback.  I really appreciate the addition.

This was a build from linux (Fedora flavor).

1) Seems there is a file that is not under svn so the initial "make 
install" was failing.

CMake Error at cmake_install.cmake:49 (FILE):
   file INSTALL cannot find "/work/osgeo/libgeotiff/csv/codes.csv".

2) My libraries went to bin on unix on a make.

3) I typically install to some prefix so I usually set 
"CMAKE_INSTALL_PREFIX" and rely on it putting things in bin, include, 
lib, share, doc.  The way it was coded I could not override.  Or I 
should say I couldn't figure it out without setting a bunch of variables 
in my cmake command.

After a little tweaking I got a good "make install".

I hope this is useful to someone.  See below for more.  I can send my 
CMakeList.txt if anyone would like.

Take care,
Dave


Here's my cmake out of source build script if anyone is interested.  
Note all my other stuff, i.e. libtiff, proj4 was installed to 
/work/osgeo/local sandbox.

//--------------
#!/bin/sh
# File: libgeotiff-cmake-config.sh
build_dir="/work/osgeo";
cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INCLUDE_PATH=${build_dir}/local/include \
-DCMAKE_INSTALL_PREFIX=${build_dir}/local \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${build_dir}/local \
-DCMAKE_LIBRARY_PATH=${build_dir}/local/lib \
-DCMAKE_MODULE_PATH=${build_dir}/ossim_package_support/cmake/CMakeModules \
../../libgeotiff/
//-------------


Here's the patch to CMakeList.txt.  Note this has hard coded things in 
it like "lib" that should be variables.  And probably should add version 
to the library output for unix's...

//----------------
--- CMakeLists.txt    (revision 2053)
+++ CMakeLists.txt    (working copy)
@@ -41,13 +41,16 @@
  SET(GEOTIFF_BUILD_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

  # Output directory in which to build RUNTIME target files.
-SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${GEOTIFF_BUILD_OUTPUT_DIRECTORY})
+# SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${GEOTIFF_BUILD_OUTPUT_DIRECTORY})
+SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

  # Output directory in which to build LIBRARY target files
-SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${GEOTIFF_BUILD_OUTPUT_DIRECTORY})
+# SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${GEOTIFF_BUILD_OUTPUT_DIRECTORY})
+SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)

  # Output directory in which to build ARCHIVE target files.
-SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${GEOTIFF_BUILD_OUTPUT_DIRECTORY})
+# SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${GEOTIFF_BUILD_OUTPUT_DIRECTORY})
+SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)

  ###############################################################################
  # Platform and compiler specific settings
@@ -200,7 +203,6 @@
      csv/alias.csv
      csv/area.csv
      csv/change.csv
-    csv/codes.csv
      csv/coordinate_axis.csv
      csv/coordinate_axis_name.csv
      csv/coordinate_operation.csv
@@ -223,6 +225,7 @@
      csv/stateplane.csv
      csv/unit_of_measure.csv
      csv/version_history.csv)
+#    csv/codes.csv

  SET(GEOTIFF_LIB_HEADERS
      geotiff.h
@@ -247,6 +250,8 @@
      epsg_vertcs.inc
      geokeys.inc)

+
+
  IF(WIN32)
      SET(DEFAULT_LIB_SUBDIR lib)
      SET(DEFAULT_DATA_SUBDIR .)
@@ -288,13 +293,16 @@
  # Install doc files
  INSTALL(FILES
      AUTHORS ChangeLog COPYING INSTALL LICENSE README README_BIN README.WIN
-    DESTINATION ${GEOTIFF_DATA_DIR}/doc)
+    DESTINATION doc)
+#    DESTINATION ${GEOTIFF_DATA_DIR}/doc)

  # Install CSV data files
-INSTALL(FILES ${GEOTIFF_CSV_DATA} DESTINATION ${GEOTIFF_DATA_DIR}/epsg_csv)
+# INSTALL(FILES ${GEOTIFF_CSV_DATA} DESTINATION 
${GEOTIFF_DATA_DIR}/epsg_csv)
+INSTALL(FILES ${GEOTIFF_CSV_DATA} DESTINATION share/epsg_csv)

  # Install header files for development distribution
-INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${GEOTIFF_INCLUDE_DIR})
+# INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${GEOTIFF_INCLUDE_DIR})
+INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION include)

  ###############################################################################
  # Build libxtiff library
@@ -348,7 +356,7 @@
  ENDIF()

  SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES
-    OUTPUT_NAME ${GEOTIFF_LIB_NAME})
+   OUTPUT_NAME ${GEOTIFF_LIB_NAME})

  TARGET_LINK_LIBRARIES(${GEOTIFF_LIBRARY_TARGET}
      ${TIFF_LIBRARIES}
@@ -356,11 +364,16 @@
      ${ZLIB_LIBRARIES}
      ${JPEG_LIBRARIES})

-INSTALL(TARGETS ${GEOTIFF_ARCHIVE_TARGET} ${GEOTIFF_LIBRARY_TARGET}
-    RUNTIME DESTINATION ${GEOTIFF_BIN_DIR}
-    LIBRARY DESTINATION ${GEOTIFF_LIB_DIR}
-    ARCHIVE DESTINATION ${GEOTIFF_LIB_DIR})
+# INSTALL(TARGETS ${GEOTIFF_ARCHIVE_TARGET} ${GEOTIFF_LIBRARY_TARGET}
+#    RUNTIME DESTINATION ${GEOTIFF_BIN_DIR}
+#   LIBRARY DESTINATION ${GEOTIFF_LIB_DIR}
+#   ARCHIVE DESTINATION ${GEOTIFF_LIB_DIR})

+INSTALL( TARGETS ${GEOTIFF_ARCHIVE_TARGET} ${GEOTIFF_LIBRARY_TARGET}
+     RUNTIME DESTINATION bin
+         LIBRARY DESTINATION lib
+     ARCHIVE DESTINATION lib )
+
  # Define grouping of source files in PROJECT file (e.g. Visual Studio)
  SOURCE_GROUP("CMake Files" FILES CMakeLists.txt)
  SOURCE_GROUP("Header Files" FILES ${GEOTIFF_LIB_HEADERS})
//---------------------------------------


Make install output:
$ make install
[ 42%] Built target geotiff_archive
[ 85%] Built target geotiff_library
[ 88%] Built target xtiff
[ 91%] Built target applygeo
[ 94%] Built target geotifcp
[ 97%] Built target listgeo
[100%] Built target makegeo
Install the project...
-- Install configuration: "Release"
-- Installing: /work/osgeo/local/doc/AUTHORS
-- Installing: /work/osgeo/local/doc/ChangeLog
-- Installing: /work/osgeo/local/doc/COPYING
-- Installing: /work/osgeo/local/doc/INSTALL
-- Installing: /work/osgeo/local/doc/LICENSE
-- Installing: /work/osgeo/local/doc/README
-- Installing: /work/osgeo/local/doc/README_BIN
-- Installing: /work/osgeo/local/doc/README.WIN
-- Up-to-date: /work/osgeo/local/share/epsg_csv/alias.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/area.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/change.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/coordinate_axis.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/coordinate_axis_name.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/coordinate_operation.csv
-- Up-to-date: 
/work/osgeo/local/share/epsg_csv/coordinate_operation_method.csv
-- Up-to-date: 
/work/osgeo/local/share/epsg_csv/coordinate_operation_parameter.csv
-- Up-to-date: 
/work/osgeo/local/share/epsg_csv/coordinate_operation_parameter_value.csv
-- Up-to-date: 
/work/osgeo/local/share/epsg_csv/coordinate_operation_path.csv
-- Up-to-date: 
/work/osgeo/local/share/epsg_csv/coordinate_reference_system.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/coordinate_system.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/datum.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/ellipsoid.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/esri_datum_override.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/gcs.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/gcs.override.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/naming_system.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/pcs.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/pcs.override.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/prime_meridian.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/projop_wparm.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/stateplane.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/unit_of_measure.csv
-- Up-to-date: /work/osgeo/local/share/epsg_csv/version_history.csv
-- Up-to-date: /work/osgeo/local/include/geotiff.h
-- Up-to-date: /work/osgeo/local/include/geotiffio.h
-- Up-to-date: /work/osgeo/local/include/geovalues.h
-- Up-to-date: /work/osgeo/local/include/geonames.h
-- Up-to-date: /work/osgeo/local/include/geokeys.h
-- Up-to-date: /work/osgeo/local/include/geo_config.h
-- Up-to-date: /work/osgeo/local/include/geo_tiffp.h
-- Up-to-date: /work/osgeo/local/include/geo_keyp.h
-- Up-to-date: /work/osgeo/local/include/geo_normalize.h
-- Up-to-date: /work/osgeo/local/include/cpl_serv.h
-- Up-to-date: /work/osgeo/local/include/geo_simpletags.h
-- Up-to-date: /work/osgeo/local/include/epsg_datum.inc
-- Up-to-date: /work/osgeo/local/include/epsg_gcs.inc
-- Up-to-date: /work/osgeo/local/include/epsg_pm.inc
-- Up-to-date: /work/osgeo/local/include/epsg_units.inc
-- Up-to-date: /work/osgeo/local/include/geo_ctrans.inc
-- Up-to-date: /work/osgeo/local/include/epsg_ellipse.inc
-- Up-to-date: /work/osgeo/local/include/epsg_pcs.inc
-- Up-to-date: /work/osgeo/local/include/epsg_proj.inc
-- Up-to-date: /work/osgeo/local/include/epsg_vertcs.inc
-- Up-to-date: /work/osgeo/local/include/geokeys.inc
-- Installing: /work/osgeo/local/lib/libgeotiff.a
-- Installing: /work/osgeo/local/lib/libgeotiff.so
-- Removed runtime path from "/work/osgeo/local/lib/libgeotiff.so"
-- Installing: /work/osgeo/local/bin/makegeo
-- Removed runtime path from "/work/osgeo/local/bin/makegeo"
-- Installing: /work/osgeo/local/bin/listgeo
-- Removed runtime path from "/work/osgeo/local/bin/listgeo"
-- Installing: /work/osgeo/local/bin/applygeo
-- Removed runtime path from "/work/osgeo/local/bin/applygeo"
-- Installing: /work/osgeo/local/bin/geotifcp
-- Removed runtime path from "/work/osgeo/local/bin/geotifcp"




More information about the Geotiff mailing list