I am trying to develop cross platform cpp code using Visual Studio 2022 Release Candidate and CMake. I'm a CMake newbie, but I've gotten a project to debug targeting local machine, WSL and RPi. The problem is that every time I change the target, I have to reselect the startup project.
I've tried setting VS_STARTUP_PROJECT as described by ComicSansMS, but to no avail.
My CMake version is not the problem as it's 3.21.21080301-MSVC_2 on local machine, 3.19.4 on WSL and 3.16.3 on RPi.
My directory structure is similar to the following:
dbe_prj
├── CMakeLists.txt
├── CMakePresets.json
├── _out
│ └── build ...
├── _dbe_test
│ ├── CMakeLists.txt
│ └── source_files
└── _dbe_lib
├── CMakeLists.txt
└── source_files
Here dbe_prj is the root directory of the project, dbe_test is an executable project and dbe_lib is a static library project.
My top level CMakeLists.txt project is as follows:
cmake_minimum_required (VERSION 3.8)
set_property(GLOBAL PROPERTY VS_STARTUP_PROJECT dbe_test)
project ("dbe_prj")
add_subdirectory ("dbe_lib")
add_subdirectory ("dbe_test")
The CMakeLists.txt file in dbe_test is as follows:
cmake_minimum_required (VERSION 3.8)
set_property(GLOBAL PROPERTY VS_STARTUP_PROJECT dbe_test)
add_executable(dbe_test "dbe_lib.cpp")
target_include_directories(dbe_test PRIVATE "../dbe_lib")
target_link_libraries(dbe_test PRIVATE dbe_lib)
I've tried setting VS_STARTUP_PROJECT in either as well as both of the files. I've tried setting it at different lines within the files and I've tried setting it with either the GLOBAL or the DIRECTORY keyword, but none of what I tried worked. What am I doing wrong? Your help is greatly appreciated!