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 1
1
add_subdirectory (${PROJECT_SOURCE_DIR} /../core codspeed)
2
2
3
3
execute_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
+ )
7
9
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 ()
10
20
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
+ )
12
25
13
26
if (DEFINED CODSPEED_MODE)
14
27
# Define a preprocessor macro based on the build mode
You can’t perform that action at this time.
0 commit comments