Skip to content

Commit

Permalink
Add support for distributing ccmake executable
Browse files Browse the repository at this point in the history
See #66
  • Loading branch information
jcfr authored and henryiii committed Nov 7, 2024
1 parent 98d07af commit e6c7ae2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
18 changes: 0 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,24 +288,6 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\

set(CMAKEPROJECT_BUILD_LAST_STEP "build")

find_program(STRIP_EXECUTABLE strip)
if(STRIP_EXECUTABLE)

set(cmake_executable "${CMakeProject_BINARY_DIR}/bin/cmake")
set(cpack_executable "${CMakeProject_BINARY_DIR}/bin/cpack")
set(ctest_executable "${CMakeProject_BINARY_DIR}/bin/ctest")

ExternalProject_Add_Step(CMakeProject-build strip_executables
DEPENDEES ${CMAKEPROJECT_BUILD_LAST_STEP}
COMMENT "Stripping CMake executables"
COMMAND ${STRIP_EXECUTABLE} ${cmake_executable}
COMMAND ${STRIP_EXECUTABLE} ${cpack_executable}
COMMAND ${STRIP_EXECUTABLE} ${ctest_executable}
USES_TERMINAL 1
)
set(CMAKEPROJECT_BUILD_LAST_STEP "strip_executables")
endif()

if(RUN_CMAKE_TEST)
include(ProcessorCount)
ProcessorCount(NB_CPU)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ test = [
]

[project.scripts]
ccmake = "cmake:ccmake"
cmake = "cmake:cmake"
cpack = "cmake:cpack"
ctest = "cmake:ctest"
Expand Down
4 changes: 4 additions & 0 deletions src/cmake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def _program_exit(name: str, *args: str) -> NoReturn:
os.execl(os.path.join(CMAKE_BIN_DIR, name), name, *args)


def ccmake() -> NoReturn:
_program_exit('ccmake', *sys.argv[1:])


def cmake() -> NoReturn:
_program_exit('cmake', *sys.argv[1:])

Expand Down

0 comments on commit e6c7ae2

Please sign in to comment.