r189406 - CMake: Fix standalone Clang build, take two.

Stephen Kelly steveire at gmail.com
Tue Aug 27 15:56:53 PDT 2013


Jordan Rose wrote:

> This time, use a variable that's defined consistently in standalone and
> non-standalone builds.

Note that with a future CMake release, you'll be able to simplify this 
further:

 http://www.cmake.org/pipermail/cmake-commits/2013-August/016048.html

Something like

 diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
 index 0a45b58..02f42ee 100644
 --- a/tools/driver/CMakeLists.txt
 +++ b/tools/driver/CMakeLists.txt
 @@ -65,11 +65,11 @@ if(UNIX)
   set(clang_binary "clang${CMAKE_EXECUTABLE_SUFFIX}")
 else()
   set(CLANGXX_LINK_OR_COPY copy)
 -  set(clang_binary 
"${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
 +  set(clang_binary "$<TARGET_FILE:clang>")
 endif()
 
 # Create the clang++ symlink in the build directory.
 -set(clang_pp 
"${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
 +set(clang_pp "$<TARGET_FILE_DIR:clang>/clang++${CMAKE_EXECUTABLE_SUFFIX}")
 add_custom_command(TARGET clang POST_BUILD
     COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" 
"${clang_pp}")
 
 @@ -77,7 +77,7 @@ set_property(DIRECTORY APPEND
   PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
 
 # Create the clang-cl symlink in the build directory.
 -set(clang_cl "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang-
cl${CMAKE_EXECUTABLE_SUFFIX}")
 +set(clang_cl "$<TARGET_FILE_DIR:clang>/clang-
cl${CMAKE_EXECUTABLE_SUFFIX}")
 add_custom_command(TARGET clang POST_BUILD
     COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" 
"${clang_cl}")


Thanks,

Steve.






More information about the cfe-commits mailing list