Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 915607
Collapse All | Expand All

(-)a/CMakeLists.txt (-23 / +20 lines)
Lines 33-41 elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") Link Here
33
    set(ALSOFT_UWP TRUE)
33
    set(ALSOFT_UWP TRUE)
34
endif()
34
endif()
35
35
36
set(CMAKE_C_VISIBILITY_PRESET hidden)
37
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
38
39
if(COMMAND CMAKE_POLICY)
36
if(COMMAND CMAKE_POLICY)
40
    cmake_policy(SET CMP0003 NEW)
37
    cmake_policy(SET CMP0003 NEW)
41
    cmake_policy(SET CMP0005 NEW)
38
    cmake_policy(SET CMP0005 NEW)
Lines 361-392 else() Link Here
361
endif()
358
endif()
362
359
363
# Set visibility/export options if available
360
# Set visibility/export options if available
364
if(WIN32)
361
if(NOT LIBTYPE STREQUAL "STATIC")
365
    if(NOT LIBTYPE STREQUAL "STATIC")
362
    if(WIN32)
366
        set(EXPORT_DECL "__declspec(dllexport)")
363
        set(EXPORT_DECL "__declspec(dllexport)")
367
    endif()
368
else()
369
    set(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
370
    # Yes GCC, really don't accept visibility modes you don't support
371
    set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
372
373
    check_c_source_compiles("int foo() __attribute__((visibility(\"protected\")));
374
                             int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
375
    if(HAVE_GCC_PROTECTED_VISIBILITY)
376
        if(NOT LIBTYPE STREQUAL "STATIC")
377
            set(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
378
        endif()
379
    else()
364
    else()
380
        check_c_source_compiles("int foo() __attribute__((visibility(\"default\")));
365
        set(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
381
                                 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
366
        # Yes GCC, really don't accept visibility modes you don't support
382
        if(HAVE_GCC_DEFAULT_VISIBILITY)
367
        set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
383
            if(NOT LIBTYPE STREQUAL "STATIC")
368
369
        check_c_source_compiles("int foo() __attribute__((visibility(\"protected\")));
370
                                int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
371
        if(HAVE_GCC_PROTECTED_VISIBILITY)
372
            set(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
373
        else()
374
            check_c_source_compiles("int foo() __attribute__((visibility(\"default\")));
375
                                    int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
376
            if(HAVE_GCC_DEFAULT_VISIBILITY)
384
                set(EXPORT_DECL "__attribute__((visibility(\"default\")))")
377
                set(EXPORT_DECL "__attribute__((visibility(\"default\")))")
385
            endif()
378
            endif()
386
        endif()
379
        endif()
387
    endif()
380
        if(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
381
            set(CMAKE_C_VISIBILITY_PRESET hidden)
382
            set(CMAKE_CXX_VISIBILITY_PRESET hidden)
383
        endif()
388
384
389
    set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
385
        set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
386
    endif()
390
endif()
387
endif()
391
388
392
389

Return to bug 915607