forked from qt-creator/qt-creator
cmake build: Fix configuration for BUILD_LIBRARIES_BY_DEFAULT=OFF
Or BUILD_LIBRARY_YAML-CPP=OFF. In that case the add_qtc_library does not result in a target, so we must check before accessing it, and should not claim that yaml-cpp is available if it isn't. Change-Id: I710ce726d65f7a1c036fd94ebeb18ead290a45f2 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -17,8 +17,6 @@ if (yaml-cpp_FOUND)
|
||||
endif()
|
||||
set_target_properties(yaml-cpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${yaml_cpp_include_dir}")
|
||||
else()
|
||||
set(yaml-cpp_FOUND 1)
|
||||
set_package_properties(yaml-cpp PROPERTIES DESCRIPTION "using internal src/libs/3rdparty/yaml-cpp")
|
||||
set(YAML_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src/libs/3rdparty/yaml-cpp)
|
||||
add_qtc_library(yaml-cpp
|
||||
DEFINES YAML_CPP_DLL yaml_cpp_EXPORTS
|
||||
@@ -114,8 +112,12 @@ else()
|
||||
${YAML_SOURCE_DIR}/src/tag.h
|
||||
${YAML_SOURCE_DIR}/src/token.h
|
||||
)
|
||||
if(MSVC)
|
||||
target_compile_options(yaml-cpp PUBLIC /wd4251 /wd4275)
|
||||
if(TARGET yaml-cpp)
|
||||
set(yaml-cpp_FOUND 1)
|
||||
set_package_properties(yaml-cpp PROPERTIES DESCRIPTION "using internal src/libs/3rdparty/yaml-cpp")
|
||||
if(MSVC)
|
||||
target_compile_options(yaml-cpp PUBLIC /wd4251 /wd4275)
|
||||
endif()
|
||||
endif()
|
||||
unset(YAML_SOURCE_DIR)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user