A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/alandefreitas/matplotplusplus/issues/185 below:

GitHub ยท Where software is built

Bug category

Describe the bug
I was trying to integrate Matplot++ with Conan, and I stumbled upon an issue with set_optimization_flags(). The function currently adds optimization flags as follows:

list(APPEND CMAKE_CXX_FLAGS " /O2")

Which gives the following kind of value to CMAKE_CXX_FLAGS:

/DWIN32 /D_WINDOWS /W3 /GR /EHsc; /O2

I am unsure whether the semicolon makes a difference for MSVC, but when building a g++-compatible command line the stray semicolon in the flags causes a hard error. Conan happens to add the architecture flag (e.g. -m64) before those, which is how I found that issue. CMAKE_CXX_FLAGS apparently expects space-separated flags, and not semicolon-separated ones, but LIST(APPEND) uses semicolons to separate list elements.

I guess that the issue wasn't diagnosed previously because LIST(APPEND) works as expected when CMAKE_CXX_FLAGS is empty.

The ideal solution would be to use target_compile_options to add the optimization flags, but if you wish to apply them globally to the project, then changing the line above (and all the equivalent lines in set_optimization_flags()) to the following line should fix the issue:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2")

Steps to Reproduce

It's in the middle of a Conan wrapper, so the steps to reproduce would a bit complicated for the issue.

Output

Along those lines:

[  2%] Building CXX object source_subfolder/source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/fruchterman_reingold.cpp.obj
[  6%] Building CXX object source_subfolder/source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/algebra.cpp.obj
[  6%] Building CXX object source_subfolder/source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/kamada_kawai.cpp.obj
[  9%] Building CXX object source_subfolder/source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/layout.cpp.obj
[ 11%] Building CXX object source_subfolder/source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/nodesoup.cpp.obj
g++.exe: error: unrecognized command-line option '-m64;'; did you mean '-m64'?
g++.exe: error: unrecognized command-line option '-m64;'; did you mean '-m64'?
g++.exe: error: unrecognized command-line option '-m64;'; did you mean '-m64'?

Platform

Environment Details:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4