Author: astitcher
Date: Wed Dec 5 17:42:58 2012
New Revision: 1417553
URL: http://svn.apache.org/viewvc?rev=1417553&view=rev
Log:
NO-JIRA: Make shared library build error on unresolved symbols where possible
- It's not possible for PHP modules as thay rely on unresolved symbols
Modified:
qpid/proton/trunk/proton-c/CMakeLists.txt
qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt
qpid/proton/trunk/proton-c/bindings/python/CMakeLists.txt
qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt
Modified: qpid/proton/trunk/proton-c/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/CMakeLists.txt?rev=1417553&r1=1417552&r2=1417553&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/CMakeLists.txt Wed Dec 5 17:42:58 2012
@@ -100,11 +100,6 @@ else (SSL_IMPL STREQUAL openssl)
set (pn_driver_ssl_impl src/ssl/ssl_stub.c)
endif (SSL_IMPL STREQUAL openssl)
-find_package(SWIG)
-if (SWIG_FOUND)
- add_subdirectory(bindings)
-endif (SWIG_FOUND)
-
# First check whether we get clock_gettime without any special library linked
CHECK_SYMBOL_EXISTS(clock_gettime "time.h" CLOCK_GETTIME_IN_LIBC)
if (CLOCK_GETTIME_IN_LIBC)
@@ -138,18 +133,27 @@ else (UUID_GENERATE_IN_LIBC)
endif (UUID_GENERATE_IN_LIBC)
option(ENABLE_WARNING_ERROR "Consider compiler warnings to be errors" ON)
+option(ENABLE_UNDEFINED_ERROR "Check for unresolved library symbols" ON)
# Set any additional platform specific C compiler flags
if (CMAKE_COMPILER_IS_GNUCC)
if (ENABLE_WARNING_ERROR)
- set (COMPILE_WARNING_FLAGS "-Wall -Werror -pedantic-errors")
- else (ENABLE_WARNING_ERROR)
- set (COMPILE_WARNING_FLAGS "-Wall -pedantic-errors")
+ set (WERROR "-Werror")
endif (ENABLE_WARNING_ERROR)
+ set (COMPILE_WARNING_FLAGS "${WERROR} -Wall -pedantic-errors")
set (COMPILE_LANGUAGE_FLAGS "-std=c99")
set (COMPILE_PLATFORM_FLAGS "-std=gnu99")
+ if (ENABLE_UNDEFINED_ERROR)
+ set (CATCH_UNDEFINED "-Wl,--no-undefined")
+ set (ALLOW_UNDEFINED "-Wl,--allow-shlib-undefined")
+ endif (ENABLE_UNDEFINED_ERROR)
endif (CMAKE_COMPILER_IS_GNUCC)
+find_package(SWIG)
+if (SWIG_FOUND)
+ add_subdirectory(bindings)
+endif (SWIG_FOUND)
+
add_subdirectory(docs/api)
add_subdirectory(docs/man)
add_subdirectory(examples/messenger/c)
@@ -210,6 +214,7 @@ set_target_properties (
PROPERTIES
VERSION "${PN_LIB_SOMAJOR}.${PN_LIB_SOMINOR}"
SOVERSION "${PN_LIB_SOMAJOR}"
+ LINK_FLAGS "${CATCH_UNDEFINED}"
)
add_executable (proton src/proton.c)
Modified: qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt?rev=1417553&r1=1417552&r2=1417553&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt Wed Dec 5 17:42:58
2012
@@ -32,9 +32,13 @@ execute_process(COMMAND ${PHP_CONFIG_EXE
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/php.i PROPERTIES
SWIG_FLAGS "-I${PROJECT_SOURCE_DIR}/include")
swig_add_module(cproton php ${CMAKE_CURRENT_SOURCE_DIR}/php.i)
-set_target_properties(cproton PROPERTIES PREFIX "")
set_source_files_properties(${swig_generated_file_fullname} PROPERTIES
COMPILE_FLAGS "${PHP_INCLUDES}")
swig_link_libraries(cproton ${BINDING_DEPS})
+# PHP modules must be linked with unresolved symbols as they are presumably
satisfied only when loaded by php itself
+set_target_properties(cproton
+ PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "${ALLOW_UNDEFINED}")
execute_process(COMMAND ${PHP_CONFIG_EXE} --extension-dir
OUTPUT_VARIABLE PHP_EXT_DIR_DEFAULT
Modified: qpid/proton/trunk/proton-c/bindings/python/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/CMakeLists.txt?rev=1417553&r1=1417552&r2=1417553&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/bindings/python/CMakeLists.txt Wed Dec 5
17:42:58 2012
@@ -21,6 +21,9 @@ set(CMAKE_SWIG_FLAGS "-threads")
include_directories (${PYTHON_INCLUDE_PATH})
swig_add_module(cproton python python.i)
swig_link_libraries(cproton ${BINDING_DEPS} ${PYTHON_LIBRARIES})
+set_target_properties(_cproton
+ PROPERTIES
+ LINK_FLAGS "${CATCH_UNDEFINED}")
find_package(PythonInterp REQUIRED)
Modified: qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt?rev=1417553&r1=1417552&r2=1417553&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt Wed Dec 5 17:42:58
2012
@@ -20,7 +20,11 @@
include_directories (${RUBY_INCLUDE_PATH})
swig_add_module(cproton-ruby ruby ruby.i)
swig_link_libraries(cproton-ruby ${BINDING_DEPS} ${RUBY_LIBRARY})
-set_target_properties(cproton-ruby PROPERTIES PREFIX "" OUTPUT_NAME "cproton")
+set_target_properties(cproton-ruby
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME "cproton"
+ LINK_FLAGS "${CATCH_UNDEFINED}" )
execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts
RbConfig::CONFIG['prefix']"
OUTPUT_VARIABLE RUBY_PREFIX
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]