Converting an old project into the CMake world, I chose not to engage the CMake Tools extension for this project because it keeps more configuration under the hood than I’m comfortable with. I’d rather see everything explicitly, so I wrote my own tasks.json and launch.json. (Which will probably become more important when I get to cross compiling, which is in my list of ambitions for this project.) And it builds, and runs.
But here’s what’s happening: the linter doesn’t know what CMake knows about include directories, and its giving me all these extra red squiggly underlines under lots of my include statements. And if anything goes wrong with the build, Visual Studio snaps the terminal view to the “Problems” tab which lists exactly the same include complaints that the linter was showing. I have to click over to the Terminal tab (every single time) to see the actual truth of what happened in the build, which is usually far less grim.
Questions:
-
How can I tell the linter what CMake knows?
-
Can I get this Problems tab to just shut up and go away? It isn’t helping anything.
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "cmake",
"args": ["--build", "${workspaceFolder}"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
project(Catchwater)
set(CMAKE_PREFIX_PATH "/opt/homebrew")
find_package(FLTK REQUIRED)
include_directories(${FLTK_INCLUDE_DIRS} . ./FromGLOW ./Pipeworks /opt/homebrew/include)
link_directories(${FLTK_LIBRARY_DIRS})
add_executable(Catchwater Pipeworks/Catchwater.cpp Pipeworks/Flow.cpp Pipeworks/PipeType.cpp Pipeworks/Tools.cpp Pipeworks/V3.cpp Pipeworks/fltkbasicgl.cpp Pipeworks/main.cpp Pipeworks/quat.cpp)
target_compile_features(Catchwater PUBLIC cxx_std_11)
target_link_libraries(Catchwater ${FLTK_LIBRARIES})