Closed sbroberg closed 8 years ago
cmake-ide-dir
wouldn't help you, that's supposed to be the build directory. As for the flags, I use cmake-ide
daily on a project with nested CMakeLists.txt
. The way CMake works is that flags defined in a parent directory are inherited. If those flags show up in compile_commands.json
, then that's how it's supposed to be. Could you check? It doesn't seem like a bug to me.
Here is the compile_commands.json clause for one of my files:
[
{
"directory": "/Users/stebro/test/daemon_cmake_db/daemon/src",
"command": \
"/usr/bin/clang++ \
-DASSERT_ON \
-DPRODVER_BUILD_NO=999 \
-DPRODVER_FULL=\\\"99.9.999\\\" \
-DPRODVER_MAJOR=99 \
-DPRODVER_MINOR=9 \
-DPRODVER_STRING=\"\\\"99.9.9d1 build 999 (2008-01-01 12:00:00)\\\"\" \
-DQT_CORE_LIB \
-DQT_NETWORK_LIB \
-DQT_NO_DEBUG \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk \
-mmacosx-version-min=10.7 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk \
-mmacosx-version-min=10.7 \
-arch i386 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk \
-mmacosx-version-min=10.7 \
-I/Users/stebro/test/daemon_cmake_db/daemon/src \
-I/Users/stebro/product/daemon/src \
-isystem /Volumes/ProductToolChain/include \
-isystem /Volumes/ProductToolChain/include/log4qt \
-isystem /Volumes/ProductToolChain/include/log4qt/varia \
-I/Users/stebro/product/daemon/src/../include \
-I/Users/stebro/product/daemon/dbcommon/include \
-F/Volumes/ProductToolChain/qt-5.5/lib \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtCore.framework/Headers \
-I/Volumes/ProductToolChain/qt-5.5/mkspecs/macx-clang-32 \
-I/Users/stebro/product/daemon/dbcommon/ClientShared/include \
-I/Users/stebro/test/daemon_cmake_db/daemon/dbcommon/ClientShared/include \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtNetwork.framework/Headers \
-I/Users/stebro/product/daemon/legacy/Client/Mac/MSDEV \
-I/Users/stebro/product/daemon/legacy/Client/Mac/MSDEV/mac/include \
-I/Users/stebro/product/daemon/legacy/Client/Mac/MSDEV/INCLUDE \
-I/Users/stebro/product/daemon/legacy/Shared/Common/../include \
-I/Users/stebro/product/daemon/legacy/Shared/Common \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibBackupEngine/../../include \
-I/Users/stebro/product/daemon/legacy/Client/Mac/Common \
-stdlib=libstdc++ \
-Werror \
-Wno-c99-extensions \
-Wno-c++98-compat \
-Wreorder \
-Wunused-variable \
-Woverloaded-virtual \
-Wno-unused-local-typedef \
-Wno-inconsistent-missing-override \
-Wunused-function \
-Wno-unknown-warning-option \
-Wno-unused-const-variable \
-Wno-redeclared-class-member \
-Wno-header-guard \
-Wno-logical-not-parentheses \
-Wno-\\#warnings \
-Wno-c++11-extensions \
-Wshorten-64-to-32 \
-include \
/Users/stebro/product/daemon/src/../include/nextgen_pch.h \
-Winvalid-pch \
-fPIC \
-o CMakeFiles/ClientNextGen.dir/services/scan/VolumeChangeMonitor.cpp.o \
-c /Users/stebro/product/daemon/src/services/scan/VolumeChangeMonitor.cpp",
"file": "/Users/stebro/product/daemon/src/services/scan/VolumeChangeMonitor.cpp"
}
]
and here is the output for the file from M-x flycheck-compile, after cmake-ide configuration:
clang -fsyntax-only \
-fno-color-diagnostics \
-fno-caret-diagnostics \
-fno-diagnostics-show-option \
-iquote \
/Users/stebro/product/daemon/src/services/scan/ \
-std\=c\+\+1y \
-include /Users/stebro/product/daemon/legacy/Shared/Library/LibUnitTest/stdafx.h \
-include /Users/stebro/product/daemon/legacy/Client/Utility/ProductRecordFileScan/ProductRecordFileScan_pch.h \
-include /Users/stebro/product/daemon/legacy/Client/Mac/daemon/source/Daemon_Prefix.pch \
-include /Users/stebro/product/daemon/legacy/Client/Mac/trampoline/trampoline_Prefix.pch \
-include /Users/stebro/product/daemon/legacy/Client/Mac/Common/MacCommon_pch.h \
-include /Users/stebro/product/daemon/legacy/Client/Library/LibBackupEngine/BackupEngine_pch.h \
-include /Users/stebro/product/daemon/legacy/Client/Library/LibHttp/ClientHttp_pch.h \
-include /Users/stebro/product/daemon/legacy/Client/Library/LibClientCommon/ClientCommon_pch.h \
-include /Users/stebro/product/daemon/legacy/Shared/Common/Common_pch.h \
-include /Users/stebro/product/daemon/legacy/Client/Mac/MSDEV/HashDefines.h \
-include /Users/stebro/product/daemon/tests/../include/nextgen_pch.h \
-include /Users/stebro/product/daemon/src/../include/nextgen_pch.h \
-Wall \
-Wextra \
-DDBCOMMON_EXPORTS \
-DLOG4QT \
-DPRODVER_BUILD_NO\=999 \
-DPRODVER_FULL\=\\\"99.9.999\\\" \
-DPRODVER_MAJOR\=99 \
-DPRODVER_MINOR\=9 \
-DPRODVER_STRING\=\"\\\"99.9.9d1 \
-DQT_CORE_LIB \
-DQT_NO_DEBUG \
-DQT_NETWORK_LIB \
-DASSERT_ON \
-DUNIT_TESTING \
-D_XCODE \
-DQT_GUI_LIB \
-DQT_WIDGETS_LIB \
-DQT_PRINTSUPPORT_LIB \
-DQT_TESTLIB_LIB \
-I/Volumes/ProductToolChain/include/log4qt/varia \
-I/Volumes/ProductToolChain/include/log4qt \
-I/Volumes/ProductToolChain/include \
-I/Users/stebro/product/daemon/daemon/dbcommon/src \
-I/Users/stebro/product/daemon/dbcommon/src \
-I/Users/stebro/product/daemon/dbcommon/include \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtCore.framework/Headers \
-I/Volumes/ProductToolChain/qt-5.5/mkspecs/macx-clang-32 \
-I/Users/stebro/product/daemon/dbcommon/ClientShared/include \
-I/Users/stebro/product/daemon/daemon/dbcommon/ClientShared/include \
-I/Users/stebro/product/daemon/daemon/dbcommon/test \
-I/Users/stebro/product/daemon/dbcommon/test \
-I/Users/stebro/product/daemon/daemon/dbcommon/tools-convert/convertstatus \
-I/Users/stebro/product/daemon/dbcommon/tools-convert/convertstatus \
-I/Users/stebro/product/daemon/daemon/dbcommon/ClientShared/src \
-I/Users/stebro/product/daemon/dbcommon/ClientShared/src \
-I/Users/stebro/product/daemon/dbcommon/ClientShared/include/QsLog \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtNetwork.framework/Headers \
-I/Users/stebro/product/daemon/daemon/dbcommon/ClientShared/test \
-I/Users/stebro/product/daemon/dbcommon/ClientShared/test \
-I/Users/stebro/product/daemon/daemon/src \
-I/Users/stebro/product/daemon/src \
-I/Users/stebro/product/daemon/src/../include \
-I/Users/stebro/product/daemon/legacy/Client/Mac/MSDEV \
-I/Users/stebro/product/daemon/legacy/Client/Mac/MSDEV/mac/include \
-I/Users/stebro/product/daemon/legacy/Client/Mac/MSDEV/INCLUDE \
-I/Users/stebro/product/daemon/legacy/Shared/Common/../include \
-I/Users/stebro/product/daemon/legacy/Shared/Common \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibBackupEngine/../../include \
-I/Users/stebro/product/daemon/legacy/Client/Mac/Common \
-I/Users/stebro/product/daemon/daemon/tests \
-I/Users/stebro/product/daemon/tests \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibHttp/../../include \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibClientCommon/../../include \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Mac/MSDEV \
-I/Users/stebro/product/daemon/daemon/legacy/Shared/Common \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Library/LibClientCommon \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibClientCommon \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Library/LibHttp \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibHttp \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Library/LibBackupEngine \
-I/Users/stebro/product/daemon/legacy/Client/Library/LibBackupEngine \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Mac/Common \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Mac/trampoline \
-I/Users/stebro/product/daemon/legacy/Client/Mac/trampoline \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Mac/daemon \
-I/Users/stebro/product/daemon/legacy/Client/Mac/daemon \
-I/Users/stebro/product/daemon/daemon/legacy/Client/Utility/ProductRecordFileScan \
-I/Users/stebro/product/daemon/legacy/Client/Utility/ProductRecordFileScan \
-I/Users/stebro/product/daemon/daemon/legacy/Shared/Library/LibUnitTest \
-I/Users/stebro/product/daemon/legacy/Shared/Library/LibUnitTest \
-I/Users/stebro/product/daemon/legacy/Shared/Library/LibUnitTest/../../include \
-I/Users/stebro/product/daemon/daemon/legacy/Shared/Library/LibUnitTest/Tests \
-I/Users/stebro/product/daemon/legacy/Shared/Library/LibUnitTest/Tests \
-I/Users/stebro/product/daemon/ui/common \
-I/Users/stebro/product/ui/common \
-I/Users/stebro/product/ui \
-I/Users/stebro/product/ui/common/ui \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtGui.framework/Headers \
-I/System/Library/Frameworks/OpenGL.framework/Headers \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtWidgets.framework/Headers \
-I/Users/stebro/product/daemon/ui/status \
-I/Users/stebro/product/ui/status \
-I/Users/stebro/product/daemon/ui/install \
-I/Users/stebro/product/ui/install \
-I/Users/stebro/product/ui/install/ui \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtPrintSupport.framework/Headers \
-I/Users/stebro/product/daemon/ui/helpers/install \
-I/Users/stebro/product/ui/helpers/install \
-I/Users/stebro/product/daemon/ui/ui \
-I/Users/stebro/product/ui/ui \
-I/Users/stebro/product/ui/ui/../ui \
-I/Users/stebro/product/daemon/ui/tests \
-I/Users/stebro/product/ui/tests \
-I/Volumes/ProductToolChain/qt-5.5/lib/QtTest.framework/Headers \
-x \
c\+\+ \
- < /Users/stebro/product/daemon/src/services/scan/VolumeChangeMonitor.cpp
I wonder if this could be related to the other issue I filed, where the quoted string in the compile option is not being handled correctly. Perhaps it is causing subsequent files in the compile_commands.json file to be included? I can do a quick check.
Maybe. I can't tell with what you've posted.
Quoted strings are not the issue. I have a new project, much simpler than the old one, which exhibits the same issue - compile options specific for one subproject are being included other subprojects. I can send you zipfile if you want to test.
Don't know about a zipfile, but something to go on would help, yes.
I can't tell if the issue is fixed or not, so I'll close this. If it still exists, please reopen with enough information about your project to enable a fix.
We have a project that looks something like this:
When we open a file that is in product/daemon/src, it appears to be using all the -I options, -include options, etc. for all projects that life under the product directory (all those listed above), instead of just those generated by the inclusion of the CMakeLists files that lead back to the root (the ones in product, product/daemon, and product/daemon/src).
You can see an example of this in my other issue, https://github.com/atilaneves/cmake-ide/issues/24.
I've tried creating a .dir-locals.el in the product/daemon/src directory that points to either the CMakeLists.txt file in product/daemon/src, or to the one in /product, but the result is the same:
Is there some other way I'm supposed to configure things to see only the relevant CMakeLists.txt files in a project?