mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Partial revert of "Revert "Revert "Hide most of non-public symbols by default (#984)" (#1038)" (#1045)"
This reverts commit 0733aeb451
.
This commit is contained in:
@@ -14,11 +14,6 @@ include(CMakeDependentOption)
|
|||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(GenerateExportHeader)
|
|
||||||
|
|
||||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
||||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
||||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
|
||||||
|
|
||||||
find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
|
find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
|
||||||
|
|
||||||
@@ -36,11 +31,13 @@ cmake_dependent_option(YAML_MSVC_SHARED_RT
|
|||||||
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
|
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
|
||||||
"MSVC" OFF)
|
"MSVC" OFF)
|
||||||
|
|
||||||
set(yaml-cpp-type STATIC)
|
|
||||||
set(yaml-cpp-label-postfix "static")
|
|
||||||
if (YAML_BUILD_SHARED_LIBS)
|
if (YAML_BUILD_SHARED_LIBS)
|
||||||
set(yaml-cpp-type SHARED)
|
set(yaml-cpp-type SHARED)
|
||||||
set(yaml-cpp-label-postfix "shared")
|
set(yaml-cpp-label-postfix "shared")
|
||||||
|
else()
|
||||||
|
set(yaml-cpp-type STATIC)
|
||||||
|
set(yaml-cpp-label-postfix "static")
|
||||||
|
add_definitions(-DYAML_CPP_STATIC_DEFINE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(build-shared $<BOOL:${YAML_BUILD_SHARED_LIBS}>)
|
set(build-shared $<BOOL:${YAML_BUILD_SHARED_LIBS}>)
|
||||||
@@ -86,7 +83,6 @@ set_property(TARGET yaml-cpp
|
|||||||
target_include_directories(yaml-cpp
|
target_include_directories(yaml-cpp
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
|
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
PRIVATE
|
PRIVATE
|
||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||||
@@ -142,12 +138,6 @@ write_basic_package_version_file(
|
|||||||
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
|
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
|
||||||
COMPATIBILITY AnyNewerVersion)
|
COMPATIBILITY AnyNewerVersion)
|
||||||
|
|
||||||
generate_export_header(yaml-cpp
|
|
||||||
BASE_NAME YAML_CPP
|
|
||||||
EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/include/yaml-cpp/dll.h"
|
|
||||||
EXPORT_MACRO_NAME YAML_CPP_API
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
|
configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
|
||||||
|
|
||||||
if (YAML_CPP_INSTALL)
|
if (YAML_CPP_INSTALL)
|
||||||
@@ -157,9 +147,6 @@ if (YAML_CPP_INSTALL)
|
|||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
||||||
FILES_MATCHING PATTERN "*.h")
|
|
||||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/include/
|
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
FILES_MATCHING PATTERN "*.h")
|
FILES_MATCHING PATTERN "*.h")
|
||||||
install(EXPORT yaml-cpp-targets
|
install(EXPORT yaml-cpp-targets
|
||||||
|
61
include/yaml-cpp/dll.h
Normal file
61
include/yaml-cpp/dll.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|
||||||
|
// Definition YAML_CPP_STATIC_DEFINE using to building YAML-CPP as static
|
||||||
|
// library (definition created by CMake or defined manually)
|
||||||
|
|
||||||
|
// Definition yaml_cpp_EXPORTS using to building YAML-CPP as dll/so library
|
||||||
|
// (definition created by CMake or defined manually)
|
||||||
|
|
||||||
|
#ifdef YAML_CPP_STATIC_DEFINE
|
||||||
|
# define YAML_CPP_API
|
||||||
|
# define YAML_CPP_NO_EXPORT
|
||||||
|
#else
|
||||||
|
# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||||
|
# ifndef YAML_CPP_API
|
||||||
|
# ifdef yaml_cpp_EXPORTS
|
||||||
|
/* We are building this library */
|
||||||
|
# pragma message( "Defining YAML_CPP_API for DLL export" )
|
||||||
|
# define YAML_CPP_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
/* We are using this library */
|
||||||
|
# pragma message( "Defining YAML_CPP_API for DLL import" )
|
||||||
|
# define YAML_CPP_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifndef YAML_CPP_NO_EXPORT
|
||||||
|
# define YAML_CPP_NO_EXPORT
|
||||||
|
# endif
|
||||||
|
# else /* No _MSC_VER */
|
||||||
|
# ifndef YAML_CPP_API
|
||||||
|
# ifdef yaml_cpp_EXPORTS
|
||||||
|
/* We are building this library */
|
||||||
|
# define YAML_CPP_API __attribute__((visibility("default")))
|
||||||
|
# else
|
||||||
|
/* We are using this library */
|
||||||
|
# define YAML_CPP_API __attribute__((visibility("default")))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifndef YAML_CPP_NO_EXPORT
|
||||||
|
# define YAML_CPP_NO_EXPORT __attribute__((visibility("hidden")))
|
||||||
|
# endif
|
||||||
|
# endif /* _MSC_VER */
|
||||||
|
#endif /* YAML_CPP_STATIC_DEFINE */
|
||||||
|
|
||||||
|
#ifndef YAML_CPP_DEPRECATED
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# define YAML_CPP_DEPRECATED __declspec(deprecated)
|
||||||
|
# else
|
||||||
|
# define YAML_CPP_DEPRECATED __attribute__ ((__deprecated__))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YAML_CPP_DEPRECATED_EXPORT
|
||||||
|
# define YAML_CPP_DEPRECATED_EXPORT YAML_CPP_API YAML_CPP_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YAML_CPP_DEPRECATED_NO_EXPORT
|
||||||
|
# define YAML_CPP_DEPRECATED_NO_EXPORT YAML_CPP_NO_EXPORT YAML_CPP_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 */
|
Reference in New Issue
Block a user