diff options
Diffstat (limited to 'Modules/CMakeDetermineOBJCCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineOBJCCompiler.cmake | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Modules/CMakeDetermineOBJCCompiler.cmake b/Modules/CMakeDetermineOBJCCompiler.cmake index 11b47fd..709eb25 100644 --- a/Modules/CMakeDetermineOBJCCompiler.cmake +++ b/Modules/CMakeDetermineOBJCCompiler.cmake @@ -39,7 +39,7 @@ else() if($ENV{${var}} MATCHES ".+") get_filename_component(CMAKE_OBJC_COMPILER_INIT $ENV{${var}} PROGRAM PROGRAM_ARGS CMAKE_OBJC_FLAGS_ENV_INIT) if(CMAKE_OBJC_FLAGS_ENV_INIT) - set(CMAKE_OBJC_COMPILER_ARG1 "${CMAKE_OBJC_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C compiler") + set(CMAKE_OBJC_COMPILER_ARG1 "${CMAKE_OBJC_FLAGS_ENV_INIT}" CACHE STRING "Arguments to Objective-C compiler") endif() if(NOT EXISTS ${CMAKE_OBJC_COMPILER_INIT}) message(FATAL_ERROR "Could not find compiler set in environment variable ${var}:\n $ENV{${var}}") @@ -65,14 +65,11 @@ else() else() # we only get here if CMAKE_OBJC_COMPILER was specified using -D or a pre-made CMakeCache.txt # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_OBJC_COMPILER is a list of length 2, use the first item as - # CMAKE_OBJC_COMPILER and the 2nd one as CMAKE_OBJC_COMPILER_ARG1 - - list(LENGTH CMAKE_OBJC_COMPILER _CMAKE_OBJC_COMPILER_LIST_LENGTH) - if("${_CMAKE_OBJC_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_OBJC_COMPILER 1 CMAKE_OBJC_COMPILER_ARG1) - list(GET CMAKE_OBJC_COMPILER 0 CMAKE_OBJC_COMPILER) - endif() + # if CMAKE_OBJC_COMPILER is a list, use the first item as + # CMAKE_OBJC_COMPILER and the rest as CMAKE_OBJC_COMPILER_ARG1 + set(CMAKE_OBJC_COMPILER_ARG1 "${CMAKE_OBJC_COMPILER}") + list(POP_FRONT CMAKE_OBJC_COMPILER_ARG1 CMAKE_OBJC_COMPILER) + list(JOIN CMAKE_OBJC_COMPILER_ARG1 " " CMAKE_OBJC_COMPILER_ARG1) # if a compiler was specified by the user but without path, # now try to find it with the full path |