Skip to content

Commit 4bef153

Browse files
committed
Fix printing Xcode version from CMake when building with Xcode
Unlike most other programs, the `xcodebuild` program does not listen to `--version`, but only to `-version`. Passing `--version` causes it to print it's usage message.
1 parent 58d080a commit 4bef153

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,12 @@ include(CMakePushCheckState)
530530

531531
# Print out path and version of any installed commands
532532
message(STATUS "CMake (${CMAKE_COMMAND}) Version: ${CMAKE_VERSION}")
533-
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --version
533+
if(XCODE)
534+
set(version_flag -version)
535+
else()
536+
set(version_flag --version)
537+
endif()
538+
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} ${version_flag}
534539
OUTPUT_VARIABLE _CMAKE_MAKE_PROGRAM_VERSION
535540
OUTPUT_STRIP_TRAILING_WHITESPACE)
536541
message(STATUS "CMake Make Program (${CMAKE_MAKE_PROGRAM}) Version: ${_CMAKE_MAKE_PROGRAM_VERSION}")

0 commit comments

Comments
 (0)