Skip to content

Commit 6af48dc

Browse files
committed
Revert "Hide most of non-public symbols by default (jbeder#984)"
This reverts commit da1c8d3.
1 parent 328d2d8 commit 6af48dc

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ include(CMakeDependentOption)
1414
include(CheckCXXCompilerFlag)
1515
include(GNUInstallDirs)
1616
include(CTest)
17-
include(GenerateExportHeader)
18-
19-
set(CMAKE_C_VISIBILITY_PRESET hidden)
20-
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
21-
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
2217

2318
find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
2419

@@ -86,7 +81,6 @@ set_property(TARGET yaml-cpp
8681
target_include_directories(yaml-cpp
8782
PUBLIC
8883
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
89-
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
9084
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
9185
PRIVATE
9286
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
@@ -142,12 +136,6 @@ write_basic_package_version_file(
142136
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
143137
COMPATIBILITY AnyNewerVersion)
144138

145-
generate_export_header(yaml-cpp
146-
BASE_NAME YAML_CPP
147-
EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/include/yaml-cpp/dll.h"
148-
EXPORT_MACRO_NAME YAML_CPP_API
149-
)
150-
151139
configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
152140

153141
if (YAML_CPP_INSTALL)
@@ -157,9 +145,6 @@ if (YAML_CPP_INSTALL)
157145
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
158146
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
159147
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
160-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
161-
FILES_MATCHING PATTERN "*.h")
162-
install(DIRECTORY ${PROJECT_BINARY_DIR}/include/
163148
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
164149
FILES_MATCHING PATTERN "*.h")
165150
install(EXPORT yaml-cpp-targets

include/yaml-cpp/dll.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2+
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
3+
4+
#if defined(_MSC_VER) || \
5+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
6+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
7+
#pragma once
8+
#endif
9+
10+
// The following ifdef block is the standard way of creating macros which make
11+
// exporting from a DLL simpler. All files within this DLL are compiled with the
12+
// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
13+
// be defined on any project that uses this DLL. This way any other project
14+
// whose source files include this file see YAML_CPP_API functions as being
15+
// imported from a DLL, whereas this DLL sees symbols defined with this macro as
16+
// being exported.
17+
#undef YAML_CPP_API
18+
19+
#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
20+
// manually)
21+
#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
22+
// or defined manually)
23+
// #pragma message( "Defining YAML_CPP_API for DLL export" )
24+
#define YAML_CPP_API __declspec(dllexport)
25+
#else // yaml_cpp_EXPORTS
26+
// #pragma message( "Defining YAML_CPP_API for DLL import" )
27+
#define YAML_CPP_API __declspec(dllimport)
28+
#endif // yaml_cpp_EXPORTS
29+
#else // YAML_CPP_DLL
30+
#define YAML_CPP_API
31+
#endif // YAML_CPP_DLL
32+
33+
#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66

src/node_data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace YAML {
1515
namespace detail {
16-
YAML_CPP_API std::atomic<size_t> node::m_amount{0};
16+
std::atomic<size_t> node::m_amount{0};
1717

1818
const std::string& node_data::empty_scalar() {
1919
static const std::string svalue;

0 commit comments

Comments
 (0)