CMake: rename imported yamlcpp library
- call it yamlcpp::yamlcpp This is source-incompatible if targets link explicitly to yamlcpp
This commit is contained in:
parent
03e621f4a2
commit
ce67712009
@ -13,7 +13,7 @@
|
||||
# YAMLCPP_LIBRARY, where to find yaml-cpp
|
||||
# YAMLCPP_INCLUDE_DIR, where to find yaml.h
|
||||
# There is also one IMPORTED library target,
|
||||
# yamlcpp
|
||||
# yamlcpp::yamlcpp
|
||||
#
|
||||
# By default, the dynamic libraries of yaml-cpp will be found. To find the static ones instead,
|
||||
# you must set the YAMLCPP_STATIC_LIBRARY variable to TRUE before calling find_package(YamlCpp ...).
|
||||
@ -21,6 +21,10 @@
|
||||
# If yaml-cpp is not installed in a standard path, you can use the YAMLCPP_DIR CMake variable
|
||||
# to tell CMake where yaml-cpp is.
|
||||
|
||||
if(TARGET yamlcpp::yamlcpp)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# attempt to find static library first if this is set
|
||||
if(YAMLCPP_STATIC_LIBRARY)
|
||||
set(YAMLCPP_STATIC libyaml-cpp.a)
|
||||
@ -61,9 +65,9 @@ mark_as_advanced(YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY)
|
||||
|
||||
# Add an imported target
|
||||
if( YAMLCPP_LIBRARY )
|
||||
add_library( yamlcpp UNKNOWN IMPORTED )
|
||||
set_property( TARGET yamlcpp PROPERTY IMPORTED_LOCATION ${YAMLCPP_LIBRARY} )
|
||||
add_library( yamlcpp::yamlcpp UNKNOWN IMPORTED )
|
||||
set_property( TARGET yamlcpp::yamlcpp PROPERTY IMPORTED_LOCATION ${YAMLCPP_LIBRARY} )
|
||||
if ( YAMLCPP_INCLUDE_DIR )
|
||||
set_property( TARGET yamlcpp PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${YAMLCPP_INCLUDE_DIR} )
|
||||
set_property( TARGET yamlcpp::yamlcpp PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${YAMLCPP_INCLUDE_DIR} )
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user