Skip to content

Commit 97ebcf0

Browse files
authored
Export library directory and shared libs to CMake config (#1113)
This pull request adds two new exported variables to the CMake config: YAML_CPP_LIBRARY_DIR - points to the directory containing the built library files YAML_CPP_SHARED_LIBS_BUILT - boolean value, lets users know whether shared libraries were built or not
1 parent 85ad599 commit 97ebcf0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ configure_package_config_file(
153153
"${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
154154
"${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
155155
INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}"
156-
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CONFIG_EXPORT_DIR)
156+
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CONFIG_EXPORT_DIR YAML_BUILD_SHARED_LIBS)
157157
unset(EXPORT_TARGETS)
158158

159159
write_basic_package_version_file(

yaml-cpp-config.cmake.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# - Config file for the yaml-cpp package
22
# It defines the following variables
3-
# YAML_CPP_INCLUDE_DIR - include directory
4-
# YAML_CPP_LIBRARIES - libraries to link against
3+
# YAML_CPP_INCLUDE_DIR - include directory
4+
# YAML_CPP_LIBRARY_DIR - directory containing libraries
5+
# YAML_CPP_SHARED_LIBS_BUILT - whether we have built shared libraries or not
6+
# YAML_CPP_LIBRARIES - libraries to link against
57

68
@PACKAGE_INIT@
79

810
set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
11+
set_and_check(YAML_CPP_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
12+
13+
# Are we building shared libraries?
14+
set(YAML_CPP_SHARED_LIBS_BUILT "@PACKAGE_YAML_BUILD_SHARED_LIBS@")
915

1016
# Our library dependencies (contains definitions for IMPORTED targets)
1117
include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)

0 commit comments

Comments
 (0)