From 0d703f6e7ca59fc56ecbb8a0d263ae1d7a6e3ae7 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Mon, 14 Aug 2017 14:47:58 -0400 Subject: [PATCH] Don't force hidden visibility on the embed target, just the module target Embedding may well be used in places where hidden visibility isn't desired. It should be relatively safe to allow it there; any potential conflict would come in if modules are loaded into that embedded interpreter, but as long as the modules are compiled with hidden visibility they shouldn't conflict. There could still be warnings if the embedded code attempts to export classes with internal (hidden) pybind members, but that seems a legitimate warning (and already has a FAQ entry). --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb51d389e..0a63bf7ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,12 +91,12 @@ if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0 $ $) target_compile_options(pybind11 INTERFACE $) - if(NOT MSVC) - target_compile_options(pybind11 INTERFACE -fvisibility=hidden) - endif() add_library(module INTERFACE) add_library(pybind11::module ALIAS module) + if(NOT MSVC) + target_compile_options(module INTERFACE -fvisibility=hidden) + endif() target_link_libraries(module INTERFACE pybind11::pybind11) if(WIN32 OR CYGWIN) target_link_libraries(module INTERFACE $)