File tree Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -260,13 +260,23 @@ set(CMAKE_EXE_LINKER_FLAGS \"-static-libstdc++ -static-libgcc -lrt\" CACHE STRIN
260
260
find_program (STRIP_EXECUTABLE strip )
261
261
if (STRIP_EXECUTABLE )
262
262
263
+ set (ccmake_executable "${CMakeProject_BINARY_DIR} /bin/ccmake" )
263
264
set (cmake_executable "${CMakeProject_BINARY_DIR} /bin/cmake" )
264
265
set (cpack_executable "${CMakeProject_BINARY_DIR} /bin/cpack" )
265
266
set (ctest_executable "${CMakeProject_BINARY_DIR} /bin/ctest" )
266
267
268
+ # Since the test for ccmake existence can not be done during the project
269
+ # configuration, stripping conditonally happens in a CMake script.
270
+ set (EXECUTABLE_TO_STRIP ${ccmake_executable} )
271
+ configure_file (
272
+ ${CMAKE_SOURCE_DIR} /scripts/strip_executable_if_exists.cmake.in
273
+ ${CMAKE_BINARY_DIR} /scripts/strip_ccmake_executable_if_exists.cmake
274
+ )
275
+
267
276
ExternalProject_Add_Step (CMakeProject-build strip_executables
268
277
DEPENDEES build
269
278
COMMENT "Stripping CMake executables"
279
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR} /scripts/strip_ccmake_executable_if_exists.cmake
270
280
COMMAND ${STRIP_EXECUTABLE} ${cmake_executable}
271
281
COMMAND ${STRIP_EXECUTABLE} ${cpack_executable}
272
282
COMMAND ${STRIP_EXECUTABLE} ${ctest_executable}
Original file line number Diff line number Diff line change 39
39
40
40
41
41
def _program (name , args ):
42
- return subprocess .call ([os .path .join (CMAKE_BIN_DIR , name )] + args )
42
+ path = os .path .join (CMAKE_BIN_DIR , name )
43
+ if not os .path .exists (path ):
44
+ return "%s is not available at %s" % (name , path )
45
+ else :
46
+ return subprocess .call ([path ] + args )
47
+
48
+
49
+ def ccmake ():
50
+ raise SystemExit (_program ('ccmake' , sys .argv [1 :]))
43
51
44
52
45
53
def cmake ():
Original file line number Diff line number Diff line change
1
+
2
+ set (STRIP_EXECUTABLE "@STRIP_EXECUTABLE@" )
3
+ set (EXECUTABLE_TO_STRIP "@EXECUTABLE_TO_STRIP@" )
4
+
5
+ if (EXISTS ${EXECUTABLE_TO_STRIP} )
6
+ execute_process (
7
+ COMMAND ${STRIP_EXECUTABLE} ${EXECUTABLE_TO_STRIP}
8
+ )
9
+ else ()
10
+ message (STATUS "Skipping stripping of non existent executable: ${EXECUTABLE_TO_STRIP} " )
11
+ endif ()
Original file line number Diff line number Diff line change @@ -44,7 +44,10 @@ def parse_requirements(filename):
44
44
45
45
entry_points = {
46
46
'console_scripts' : [
47
- 'cmake=cmake:cmake' , 'cpack=cmake:cpack' , 'ctest=cmake:ctest'
47
+ 'ccmake=cmake:ccmake' ,
48
+ 'cmake=cmake:cmake' ,
49
+ 'cpack=cmake:cpack' ,
50
+ 'ctest=cmake:ctest'
48
51
]
49
52
},
50
53
You can’t perform that action at this time.
0 commit comments