Skip to content

Commit 17f085c

Browse files
committed
Minor improvements to cmkr.cmake
1 parent 5ad6134 commit 17f085c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmake/cmkr.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CMKR_EXECUTABLE "" CACHE FILEPATH "cmkr executable")
99
set(CMKR_SKIP_GENERATION OFF CACHE BOOL "skip automatic cmkr generation")
1010

1111
# Disable cmkr if generation is disabled
12-
if(CMKR_SKIP_GENERATION)
12+
if(DEFINED ENV{CI} OR CMKR_SKIP_GENERATION)
1313
message(STATUS "[cmkr] Skipping automatic cmkr generation")
1414
macro(cmkr)
1515
endmacro()
@@ -132,10 +132,15 @@ macro(cmkr)
132132

133133
file(SHA256 "${CMAKE_CURRENT_LIST_FILE}" CMKR_LIST_FILE_SHA256_POST)
134134

135+
# Delete the temporary file if it was left for some reason
136+
set(CMKR_TEMP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMakerLists.txt")
137+
if(EXISTS "${CMKR_TEMP_FILE}")
138+
file(REMOVE "${CMKR_TEMP_FILE}")
139+
endif()
140+
135141
if(NOT CMKR_LIST_FILE_SHA256_PRE STREQUAL CMKR_LIST_FILE_SHA256_POST)
136142
# Copy the now-generated CMakeLists.txt to CMakerLists.txt
137143
# This is done because you cannot include() a file you are currently in
138-
set(CMKR_TEMP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMakerLists.txt")
139144
configure_file(CMakeLists.txt "${CMKR_TEMP_FILE}" COPYONLY)
140145

141146
# Add the macro required for the hack at the start of the cmkr macro

0 commit comments

Comments
 (0)