conan: cmake generator produces invalid conanbuildinfo.cmake when there are multiple CPPFLAGS
I have a package (GoogleTest) that is passing more than one flag to its consumers via cpp_info.cppflags
. In the generated conanbuildinfo.cmake, the line set(CONAN_CXX_FLAGS_GOOGLETEST "-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LINKED_AS_SHARED_LIBRARY=1")
causes CMake to issue a compilation command of the form:
/longest_path/c++ -isystem /longer_path/include -stdlib=libc++ -O3 -DNDEBUG -fPIE "-Wall -Werror -DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LINKED_AS_SHARED_LIBRARY=1" -std=c++11 -o CMakeFiles/main.dir/main.cpp.o -c /long_path/main.cpp
It looks like the CMakeFiles/main.dir/flags.make file contains:
CXX_FLAGS = -stdlib=libc++ -O3 -DNDEBUG -fPIE "-Wall -Werror -DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LINKED_AS_SHARED_LIBRARY=1" -std=c++11
I believe the fix is to remove the double quotes from the generated CMake set
command.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (14 by maintainers)
Commits related to this issue
- Create sample project to reproduce conan cmake bug. https://github.com/conan-io/conan/issues/950 — committed to kent-at-multiscale/cmake-multiple-flags-bug by kent-at-multiscale 7 years ago
Acknowledged, revert it and fix everybody else. When (or if) I reproduce it again I’ll provide functioning code.