File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11add_subdirectory (${PROJECT_SOURCE_DIR} /../core codspeed)
22
33execute_process (
4- COMMAND git rev-parse --show-toplevel
5- OUTPUT_VARIABLE GIT_ROOT_DIR
6- OUTPUT_STRIP_TRAILING_WHITESPACE)
4+ COMMAND git rev-parse --show-toplevel
5+ OUTPUT_VARIABLE GIT_ROOT_DIR
6+ OUTPUT_STRIP_TRAILING_WHITESPACE
7+ RESULT_VARIABLE GIT_COMMAND_RESULT
8+ )
79
8- target_compile_definitions (codspeed
9- INTERFACE -DCODSPEED_GIT_ROOT_DIR="${GIT_ROOT_DIR} " )
10+ if (NOT GIT_COMMAND_RESULT EQUAL 0)
11+ message (
12+ WARNING
13+ "Failed to determine the git root directory.\
14+ Check that git is in your PATH, and that you are in a git repository.\
15+ Continuing, but codspeed features will not be useable"
16+ )
17+ # Default to user's cmake source directory
18+ set (GIT_ROOT_DIR ${CMAKE_SOURCE_DIR} )
19+ endif ()
1020
11- # Step 1: Check if CODSPEED_MODE is set via the command line
21+ target_compile_definitions (
22+ codspeed
23+ INTERFACE -DCODSPEED_GIT_ROOT_DIR="${GIT_ROOT_DIR} "
24+ )
1225
1326if (DEFINED CODSPEED_MODE)
1427 # Define a preprocessor macro based on the build mode
You can’t perform that action at this time.
0 commit comments