vendredi 13 septembre 2019

How can I find out which module is adding a given compile flag in Cmake?

I'm facing the following problem: I have a CMake project with a few targets and a multitude of dependencies added via find_package(). I am using set(CMAKE_CXX_STANDARD 11) to compile with C++11, nevertheless somehow, the -std=gnu-c++14 flag makes it into the command line, which I can see when compiling with CMAKE_VERBOSE_MAKEFILE=1.

/usr/local/opt/ccache/libexec/c++  -DCORE_DEBUG -DDISABLE_LIBUSB_1_0 -DDISABLE_PCAP
-DDISABLE_PNG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB
-DvtkRenderingContext2D_AUTOINIT="1(vtkRenderingContextOpenGL2)"
-DvtkRenderingCore_AUTOINIT="3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2)"
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
-Isrc -Ibuild -I/usr/local/include/spinnaker -Ibuild/gtest/src/gtest/googletest/include
-Ibuild/gtest/src/gtest/googlemock/include -isystem /usr/local/include/eigen3 -isystem
/usr/local/Cellar/vtk/8.2.0_1/include/vtk-8.2 -isystem /usr/local/include -isystem
/usr/local/include/pcl-1.9 -isystem /usr/local/Cellar/eigen/3.3.7/include/eigen3
-isystem /Users/ -isystem /usr/local/Cellar/opencv/4.1.0_2/include/opencv4 -isystem
libs/tensorflow/include -isystem /usr/local/Cellar/zeromq/4.3.2/include -iframework
/usr/local/opt/qt/lib -isystem /usr/local/opt/qt/lib/QtWidgets.framework/Headers
-isystem /usr/local/opt/qt/lib/QtGui.framework/Headers -isystem
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers
-isystem /usr/local/opt/qt/lib/QtCore.framework/Headers -isystem
/usr/local/opt/qt/./mkspecs/macx-clang  -DPCL_ONLY_CORE_POINT_TYPES=ON
-DNO_EXPLICIT_INSTANTIATIONS -g -g -O0 -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk   -Wno-deprecated-declarations
-Wno-unused-parameter -Wno-sign-compare -std=gnu-c++11 -Wno-unused-private-field -fPIC
-std=gnu++14 -o CMakeFiles/…file1.cpp.o -c src/…file1.cpp
# ^see here

I would like to know where it comes form, as I am not setting it myself. I suspect OpenCV 4.1 and PCL 1.9, but the *_DEFINITIONS properties of the two packages do not include it.

How can I find out who the hell is adding that option and how can I force my own options to be added at the end (regardless of whether that is advisable)?

Aucun commentaire:

Enregistrer un commentaire