[CMake] Removing duplicate entries from CXXFLAGS

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Mon Oct 5 09:23:01 EDT 2015


Dear All,

Let me try a simpler question this time. (I'm a bit disappointed that nobody had any comments on my question about sub-projects.)

I'm trying to clean up my project's build a bit. As it collects compilation flags from a few separate places, by the time it finishes collecting everything, the compilation commands are usually very long. As they have many duplications. Like:

-m64 -pipe -W
 -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -Wno-deprecated-declaration
s -stdlib=libc++ -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++
11 -Wno-deprecated-declarations -stdlib=libc++ -Wno-unused-local-typedefs -Wno-tautological-undefined-compare -Wno-incon
sistent-missing-override -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread
-std=c++11 -Wno-deprecated-declarations -stdlib=libc++ -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-commo
n -Qunused-arguments -pthread -std=c++11 -Wno-deprecated-declarations -stdlib=libc++ -m64 -pipe -W -Wall -Woverloaded-vi
rtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -Wno-deprecated-declarations -stdlib=libc++ -m64
-pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -Wno-deprecated-dec
larations -stdlib=libc++ -m64 -pipe -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -stdlib=libc++

Naturally it would help the build log reading tremendously if I could remove the duplications from these lines. But I can't find a good way of doing it. How could I weed out all the duplications in the CXXFLAGS associated to a given target?

Cheers,
            Attila


More information about the CMake mailing list