Skip to content

Commit

Permalink
CMake: add ability to set solution folder name
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixaill committed Oct 27, 2021
1 parent 491ea58 commit e5dbbd5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
message("${SENTRY_BACKEND}")

if(WIN32)
cmake_minimum_required (VERSION 3.16.4)

Expand Down Expand Up @@ -229,6 +231,10 @@ endif()

set_target_properties(sentry PROPERTIES PUBLIC_HEADER "include/sentry.h")

if(DEFINED SENTRY_FOLDER)
set_target_properties(sentry PROPERTIES FOLDER ${SENTRY_FOLDER})
endif()

# check size type
include(CheckTypeSize)
check_type_size("long" CMAKE_SIZEOF_LONG)
Expand Down Expand Up @@ -439,6 +445,20 @@ if(SENTRY_BACKEND_CRASHPAD)
set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

if(DEFINED SENTRY_FOLDER)
set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER})
endif()

target_link_libraries(sentry PRIVATE
$<BUILD_INTERFACE:crashpad::client>
$<INSTALL_INTERFACE:sentry_crashpad::client>
Expand Down Expand Up @@ -467,6 +487,11 @@ elseif(SENTRY_BACKEND_BREAKPAD)
target_link_libraries(sentry PRIVATE
breakpad_client
)

if(DEFINED SENTRY_FOLDER)
set_target_properties(breakpad_client PROPERTIES FOLDER ${SENTRY_FOLDER})
endif()

if(NOT SENTRY_BUILD_SHARED_LIBS)
sentry_install(TARGETS breakpad_client EXPORT sentry
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand Down Expand Up @@ -543,5 +568,9 @@ if(SENTRY_BUILD_EXAMPLES)
set_property(TARGET sentry_example PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

if(DEFINED SENTRY_FOLDER)
set_target_properties(sentry_example PROPERTIES FOLDER ${SENTRY_FOLDER})
endif()

add_test(NAME sentry_example COMMAND sentry_example)
endif()
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ Legend:
- ✓ supported
- unsupported

- `SENTRY_FOLDER` (Default: not defined):
Sets the sentry-native projects folder name for generators which supports project hierarchy (like Microsoft Visual Studio).
To use this feature you need to enable hierarchy via [`USE_FOLDERS` property](https://cmake.org/cmake/help/latest/prop_gbl/USE_FOLDERS.html)

### Build Targets

- `sentry`: This is the main library and the only default build target.
Expand Down

0 comments on commit e5dbbd5

Please sign in to comment.