CMake: add -fPIC flag to combine static libraries to dynamic one
authorJim Huang <jserv@0xlab.org>
Fri, 4 Nov 2011 18:24:39 +0000 (02:24 +0800)
committerPeng Wu <alexepico@gmail.com>
Mon, 7 Nov 2011 03:22:41 +0000 (11:22 +0800)
Machines running Linux on architectures such as amd64 require flag
"-fPIC" to be specified to compile shared libraries, and it would
be helpful to have this a default for CMake when building libpinyin.

src/lookup/CMakeLists.txt
src/storage/CMakeLists.txt

index bb5b8ba..bd29b4a 100644 (file)
@@ -1,4 +1,8 @@
 set(
+    CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC"
+)
+
+set(
     LIBLOOKUP_HEADERS
     lookup.h
     pinyin_lookup.h
index b775350..59f6bfd 100644 (file)
@@ -1,4 +1,8 @@
 set(
+    CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC"
+)
+
+set(
     LIBSTORAGE_HEADERS
     pinyin_large_table.h
     pinyin_base.h