[Liblas-commits] hg: Compile sources with -fPIC flag even for
static library. NOT...
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Oct 26 18:01:05 EDT 2010
changeset ac091a5f5728 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ac091a5f5728
summary: Compile sources with -fPIC flag even for static library. NOTE: linking static libraries into shared library is highly not portable, but we are too lazy to agree to compile all sources twice for each library separately.
diffstat:
src/CMakeLists.txt | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diffs (48 lines):
diff -r 368181fe207c -r ac091a5f5728 src/CMakeLists.txt
--- a/src/CMakeLists.txt Tue Oct 26 21:07:21 2010 +0100
+++ b/src/CMakeLists.txt Tue Oct 26 23:00:49 2010 +0100
@@ -194,22 +194,17 @@
${LIBLAS_HEADERS_DIR}/capi/liblas.h
las_c_api.cpp)
-# Static libLAS C++ library
+# NOTE:
+# This hack is required to correctly link static into shared library.
+# Such practice is not recommended as not portable, instead each library,
+# static and shared should be built from sources separately.
+if(UNIX)
+ add_definitions("-fPIC")
+endif()
+
add_library(${LIBLAS_LIB_NAME} STATIC ${LIBLAS_SOURCES})
-
-# Shared libLAS C library
add_library(${LIBLAS_C_LIB_NAME} SHARED ${LIBLAS_C_SOURCES})
-if (APPLE)
- set_target_properties(
- ${LIBLAS_C_LIB_NAME}
- PROPERTIES
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
-
- )
-endif(APPLE)
-
-########
target_link_libraries(${LIBLAS_C_LIB_NAME}
${LIBLAS_LIB_NAME}
${TIFF_LIBRARY}
@@ -217,6 +212,13 @@
${GDAL_LIBRARY}
${SPATIALINDEX_LIBRARY})
+if (APPLE)
+ set_target_properties(
+ ${LIBLAS_C_LIB_NAME}
+ PROPERTIES
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+endif()
+
###############################################################################
# Targets installation
More information about the Liblas-commits
mailing list