CMake: replace `rm' with portable invocations of cmake.

Based on a bug report by Yonggang Luo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61875 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Oscar Fuentes 2009-01-07 19:24:44 +00:00
parent acf984417f
commit 82447ebb41
2 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ macro(add_partially_linked_object lib)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX} COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll} COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION} COMMAND ${CMAKE_COMMAND} -E remove -f *${CMAKE_CXX_OUTPUT_EXTENSION}
) )
target_name_of_partially_linked_object(${lib} tnplo) target_name_of_partially_linked_object(${lib} tnplo)
add_custom_target(${tnplo} ALL DEPENDS ${pll}) add_custom_target(${tnplo} ALL DEPENDS ${pll})

View File

@ -54,7 +54,7 @@ configure_file(
set(LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt) set(LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt)
set(LIBDEPS_TMP ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt.tmp) set(LIBDEPS_TMP ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt.tmp)
set(FINAL_LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/FinalLibDeps.txt) set(FINAL_LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/FinalLibDeps.txt)
set(LLVM_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config) set(LLVM_CONFIG ${LLVM_TOOLS_BINARY_DIR}/llvm-config)
set(LLVM_CONFIG_IN ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in) set(LLVM_CONFIG_IN ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in)
if( CMAKE_CROSSCOMPILING ) if( CMAKE_CROSSCOMPILING )
@ -78,7 +78,7 @@ add_custom_command(OUTPUT ${LIBDEPS}
COMMENT "Updated ${LIBDEPS} because dependencies changed") COMMENT "Updated ${LIBDEPS} because dependencies changed")
add_custom_command(OUTPUT ${FINAL_LIBDEPS} add_custom_command(OUTPUT ${FINAL_LIBDEPS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS} || rm -f ${FINAL_LIBDEPS} COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS} || ${CMAKE_COMMAND} -E remove -f ${FINAL_LIBDEPS}
DEPENDS ${LIBDEPS} DEPENDS ${LIBDEPS}
COMMENT "Checking for cyclic dependencies between LLVM libraries.") COMMENT "Checking for cyclic dependencies between LLVM libraries.")
@ -91,10 +91,10 @@ add_custom_command(OUTPUT ${LLVM_CONFIG}
COMMAND echo 's,@LIBS@,,' >> temp.sed # TODO: System libs COMMAND echo 's,@LIBS@,,' >> temp.sed # TODO: System libs
COMMAND echo 's,@LLVM_BUILDMODE@,${CMAKE_BUILD_TYPE},' >> temp.sed COMMAND echo 's,@LLVM_BUILDMODE@,${CMAKE_BUILD_TYPE},' >> temp.sed
COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG} COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG}
COMMAND rm temp.sed COMMAND ${CMAKE_COMMAND} -E remove -f temp.sed
COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG} COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG}
COMMAND chmod +x ${LLVM_CONFIG} COMMAND chmod +x ${LLVM_CONFIG}
COMMAND cd ${CMAKE_BINARY_DIR} && ${CMAKE_COMMAND} -U HAVE_LLVM_CONFIG ${CMAKE_SOURCE_DIR} COMMAND cd ${CMAKE_BINARY_DIR} && ${CMAKE_COMMAND} -U HAVE_LLVM_CONFIG -D LLVM_BINARY_DIR="${LLVM_BINARY_DIR}" ${CMAKE_SOURCE_DIR}
DEPENDS ${FINAL_LIBDEPS} ${LLVM_CONFIG_IN} DEPENDS ${FINAL_LIBDEPS} ${LLVM_CONFIG_IN}
COMMENT "Building llvm-config script." COMMENT "Building llvm-config script."
) )