From 173185d1e688fefeb82516962652c21e8fc949d1 Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Fri, 27 Feb 2015 21:13:00 -0500 Subject: [PATCH 1/7] Added the option to disable the building of example binaries in the cmake build system. --- CMakeLists.txt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c0247cc5..00c222700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set(VERSION "1.2.8") option(ASM686 "Enable building i686 assembly implementation") option(AMD64 "Enable building amd64 assembly implementation") +option(DISABLE_EXAMPLE_BINARIES "Disable the building of example binaries") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -230,20 +231,22 @@ endif() # Example binaries #============================================================================ -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) +if(NOT DISABLE_EXAMPLE_BINARIES) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) + add_executable(minigzip test/minigzip.c) + target_link_libraries(minigzip zlib) -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + if(HAVE_OFF64_T) + add_executable(example64 test/example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) + + add_executable(minigzip64 test/minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() endif() From 706cf4e40bb78e710b21f5fba0146140affa9929 Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Sun, 8 Mar 2015 16:42:45 -0400 Subject: [PATCH 2/7] Added an option to compile the static library with -fPIC in the cmake build system. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00c222700..cf77ce884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,10 @@ project(zlib C) set(VERSION "1.2.8") -option(ASM686 "Enable building i686 assembly implementation") -option(AMD64 "Enable building amd64 assembly implementation") -option(DISABLE_EXAMPLE_BINARIES "Disable the building of example binaries") +option(ASM686 "Enable building i686 assembly implementation") +option(AMD64 "Enable building amd64 assembly implementation") +option(DISABLE_EXAMPLE_BINARIES "Disable the building of example binaries") +option(COMPILE_STATIC_LIB_WITH_FPIC "use -FPIC when compiling the static lib.") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -202,6 +203,9 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz + if(COMPILE_STATIC_LIB_WITH_FPIC) + set_target_properties(zlibstatic PROPERTIES LINK_FLAGS "-fPIC") + endif() set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) if(NOT APPLE) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") From 3f6a823e85db565925fac1ba8b7735142dc66afc Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Sun, 8 Mar 2015 17:09:57 -0400 Subject: [PATCH 3/7] It would help if -fPIC was in the compile flags... --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf77ce884..b5fd9e7aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(VERSION "1.2.8") option(ASM686 "Enable building i686 assembly implementation") option(AMD64 "Enable building amd64 assembly implementation") option(DISABLE_EXAMPLE_BINARIES "Disable the building of example binaries") -option(COMPILE_STATIC_LIB_WITH_FPIC "use -FPIC when compiling the static lib.") +option(COMPILE_STATIC_LIB_WITH_FPIC "use -fPIC when compiling the static lib.") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -204,7 +204,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz if(COMPILE_STATIC_LIB_WITH_FPIC) - set_target_properties(zlibstatic PROPERTIES LINK_FLAGS "-fPIC") + set_target_properties(zlibstatic PROPERTIES COMPILE_FLAGS "-fPIC") endif() set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) if(NOT APPLE) From eef77275d2e2a78894d1e7445b335095f3ac0b9c Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Thu, 12 Mar 2015 16:01:27 -0400 Subject: [PATCH 4/7] A bit of cmake debigging... --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5fd9e7aa..fc12adbf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,8 +202,11 @@ if(NOT CYGWIN) endif() if(UNIX) + + message("UNIX----------------------------------------------------------------------------------------------------------------------------------------------------------") # On unix-like platforms the library is almost always called libz if(COMPILE_STATIC_LIB_WITH_FPIC) + message("fPIC------------------------------------------------------------------------------------------------------------------------------------------------------------") set_target_properties(zlibstatic PROPERTIES COMPILE_FLAGS "-fPIC") endif() set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) From c985b344eae27e12589dbcb25c785d30f604439d Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Thu, 12 Mar 2015 16:19:12 -0400 Subject: [PATCH 5/7] More cmake debugging with Travis... --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc12adbf5..0d013dbe2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,8 @@ if(NOT CYGWIN) set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) endif() +message("${UNIX} ------------------------------------------------------------------------------------------------------------------------------------------------------------") + if(UNIX) message("UNIX----------------------------------------------------------------------------------------------------------------------------------------------------------") From 8e1f438dd1cd453f754ebaf8fd73eec833f3e675 Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Thu, 12 Mar 2015 16:51:44 -0400 Subject: [PATCH 6/7] Trying to igure out why fpic is not firing on travis. --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d013dbe2..6a70ff472 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,12 +201,9 @@ if(NOT CYGWIN) set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) endif() -message("${UNIX} ------------------------------------------------------------------------------------------------------------------------------------------------------------") - if(UNIX) - - message("UNIX----------------------------------------------------------------------------------------------------------------------------------------------------------") # On unix-like platforms the library is almost always called libz + message ("${COMPILE_STATIC_LIB_WITH_FPIC}" ----------------------------------------------------------------------------------) if(COMPILE_STATIC_LIB_WITH_FPIC) message("fPIC------------------------------------------------------------------------------------------------------------------------------------------------------------") set_target_properties(zlibstatic PROPERTIES COMPILE_FLAGS "-fPIC") From 31862bcb4358b83b7c6bac0d20c1662d1c8e97e4 Mon Sep 17 00:00:00 2001 From: Cyberunner23 Date: Thu, 12 Mar 2015 19:05:15 -0400 Subject: [PATCH 7/7] Issue fixed with Travis build. --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a70ff472..b5fd9e7aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,9 +203,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz - message ("${COMPILE_STATIC_LIB_WITH_FPIC}" ----------------------------------------------------------------------------------) if(COMPILE_STATIC_LIB_WITH_FPIC) - message("fPIC------------------------------------------------------------------------------------------------------------------------------------------------------------") set_target_properties(zlibstatic PROPERTIES COMPILE_FLAGS "-fPIC") endif() set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)