From 697bf6653a8c7421f0e821ee8d42471246e6850f Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 4 Feb 2019 12:31:40 +0100 Subject: [PATCH 1/4] cmake: fix symbol visibility Avoid exposing unexported symbols, matches autotools behavior. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc9116d..a271876 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ else() if (NOT IOS) add_definitions("-Werror") endif() + add_definitions("-fvisibility=hidden") endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) From a5907daf1b111e4ad7aab4f558f57e2af1e37e55 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 4 Feb 2019 13:08:10 +0100 Subject: [PATCH 2/4] CMake: install pkg-config files for parity with autotools --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a271876..e1496a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,19 @@ configure_file(Bcg729Config.cmake.in @ONLY ) +set(prefix "${CMAKE_INSTALL_PREFIX}") +set(exec_prefix "\${prefix}") +set(includedir "\${prefix}/include") +set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +configure_file(libbcg729.pc.in + "${CMAKE_CURRENT_BINARY_DIR}/libbcg729.pc" + @ONLY +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/libbcg729.pc" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) + set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Bcg729/cmake") install(EXPORT Bcg729Targets FILE Bcg729Targets.cmake From f8ca5b8a5004789a670236a2a3f5ef13477bddab Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 18 Mar 2019 10:22:40 -0700 Subject: [PATCH 3/4] Handle macOS systems with glibtoolize in /usr/local/bin. Not all such systems have it in /opt/local/bin. --- autogen.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autogen.sh b/autogen.sh index db84113..9d1e7cf 100755 --- a/autogen.sh +++ b/autogen.sh @@ -18,6 +18,9 @@ fi if test -f /opt/local/bin/glibtoolize ; then # darwin LIBTOOLIZE=/opt/local/bin/glibtoolize +elif test -f /usr/local/bin/glibtoolize ; then + # also darwin + LIBTOOLIZE=/usr/local/bin/glibtoolize else LIBTOOLIZE=libtoolize fi From d63ce04a93711820d9a6985b1d11d8d91ed8e6b6 Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Tue, 19 Mar 2019 15:35:05 +0700 Subject: [PATCH 4/4] Maintain symbol visibility when testing is enabled --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1496a7..cc27fc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,9 @@ else() if (NOT IOS) add_definitions("-Werror") endif() - add_definitions("-fvisibility=hidden") + if(NOT ENABLE_TESTS) # test access inner functions so maintain visibility if we want to run tests + add_definitions("-fvisibility=hidden") + endif() endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)