![]() ![]() Make sure nfigureOnOpen is not defined to false (the default is true, so if it's missing you're good). Set loggingLevel to debug for CMake Tools and CppTools. I am thinking of doing the following to know more where the root problem is. I tried following the intellisense tips and fixes found on the CMake tools help site, such as including the header files within a call to target_sources in the CMakeLists.txt file located within the subdirectory. Everything still configures and compiles without any issue however. Steps 1 to 7 repeat without any difference.Īt step 8 however, red error squiggles appear under #include "test.hpp" at the top of main.cpp, with the error message "Cannot open source file "test.hpp"" appearing when you hover over it. Intellisense should be able to locate test.hpp within the "src" subdirectory.After configuring, add #include "test.hpp" at the top of main.cpp.In the top level CMakeLists.txt, add a call to add_subdirectory(src).Add an empty test.hpp within the same subdirectory.Add a CMakeLists.txt within it containing target_include_directories(target PRIVATE $.Use "CMake: Quick Start" and allow CMake tools to configure intellisense.Open new folder in a new window in vscode.I also get zero configuration errors and everything still compiles perfectly just like the old project mentioned above which still has functioning intellisense. It reports red error squiggles beneath #include statements for headers contained within these subdirectories. However, I've tried multiple times now to start new CMake projects in different folders and intellisense does not to be able to open up headers in subdirectories anymore. In fact, intellisense STILL works JUST in this project folder funnily enough. With this setup intellisense worked perfectly for the headers within this subdirectory and everything compiles properly. I would call add_subdirectory() from a higher level CMakelists.txt and add a target_include_directories() within the subdirectory. Interestingly, when I put the dependencies.cmake in the outmost directory (alongside cmakelists.txt ) both cases work.Hi there, up until yesterday I was working on a CMake project that included headers from subdirectories within the project. Output: 1> - The CXX compiler identification is MSVC 9.0ġ> - Detecting CXX compiler ABI infoġ> - Detecting CXX compiler ABI info - doneġ> - Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/6/bin/Host圆4/圆4/cl.exe - skippedġ> - Detecting CXX compile featuresġ> - Detecting CXX compile features - doneġ> moduleC:/Users//source/repos/LibraryTests/cmakeġ> CMake Error at C:\Users\\source\repos\LibraryTests\CMakeLists.txt:16 (include):ġ> include could not find requested file: ![]() #does seem to work for MSVC, but is this portable?! #does not work, even though this is listed in professional cmake book: #shows the correct path, so appending worked. Top-level cmakelists: cmake_minimum_required (VERSION 3.21) See below? Can anybody explain what is going on? What is a portable approach for including a I cannot seem to include it following the approach in professional cmake book. I have top-level cmakelists, with in subdirectory “cmake” a file “dependencies.cmake”. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |