File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -25,19 +25,22 @@ else()
25
25
set (GIT_INDEX "" )
26
26
endif ()
27
27
28
- # Add a custom command to rebuild build-info.cpp when .git/index changes
29
- add_custom_command (
30
- OUTPUT "${CMAKE_CURRENT_SOURCE_DIR} /build-info.cpp"
31
- COMMENT "Generating build details from Git"
32
- COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
33
- -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME}
34
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -P "${CMAKE_CURRENT_SOURCE_DIR} /../scripts/gen-build-info-cpp.cmake"
35
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /.."
36
- DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /build-info.cpp.in" ${GIT_INDEX}
37
- VERBATIM
38
- )
39
- set (TARGET build_info )
40
- add_library (${TARGET} OBJECT build -info.cpp )
28
+ if (EXISTS GIT_INDEX )
29
+ # Add a custom command to rebuild build-info.cpp when .git/index changes
30
+ add_custom_command (
31
+ OUTPUT "${CMAKE_CURRENT_SOURCE_DIR} /build-info.cpp"
32
+ COMMENT "Generating build details from Git"
33
+ COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
34
+ -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME}
35
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -P "${CMAKE_CURRENT_SOURCE_DIR} /../scripts/gen-build-info-cpp.cmake"
36
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /.."
37
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /build-info.cpp.in" ${GIT_INDEX}
38
+ VERBATIM
39
+ )
40
+ set (TARGET build_info )
41
+ add_library (${TARGET} OBJECT build -info.cpp )
42
+ endif ()
43
+
41
44
if (BUILD_SHARED_LIBS )
42
45
set_target_properties (${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON )
43
46
endif ()
You can’t perform that action at this time.
0 commit comments