Issue
I'm using CMake to generate the Visual Studio solution for my project, and inside it I'm using many third party libraries and when I generate the solution it looks like this:
href="https://i.stack.imgur.com/Tm90L.png" rel="nofollow noreferrer">
I want to create a specific group for third party, just like cmake is creating one for "CMakePredefinedTargets"
How can I do that?
This is my main CMake file:
cmake_minimum_required(VERSION 3.24)
project(VoidEngine)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DEN_DEBUG")
ADD_DEFINITIONS(
-std=c++17 # Or -std=c++0x
# Other flags
)
include(C:/Users/user/vcpkg/scripts/buildsystems/vcpkg.cmake)
add_subdirectory(Game)
add_subdirectory(Engine)
add_subdirectory(Server)
add_subdirectory(HeadlessClient)
# ---------------- Third party modules -------------------
add_subdirectory(ThirdParty/SDL2)
add_subdirectory(ThirdParty/zlib)
# ---- Steam Game Networking sockets definitions ------
add_definitions(-DBUILD_STATIC_LIB=1)
add_subdirectory(ThirdParty/GameNetworkingSockets)
remove_definitions(-DBUILD_STATIC_LIB=1)
# ------------------------------------------------------
add_subdirectory(ThirdParty/bgfx-cmake)
target_link_libraries (Game Engine SDL2-static bgfx)
target_link_libraries (HeadlessClient Engine SDL2-static bgfx protobuf GameNetworkingSockets_s)
Solution
The FOLDER
property on a target tells generators to put that target in a folder. You can use the CMAKE_FOLDER
to do this for all targets in a directory.
Answered By - Botje Answer Checked By - Dawn Plyler (WPSolving Volunteer)