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 $)