Skip to content

Commit

Permalink
[CMake] Add custom target to create build directory
Browse files Browse the repository at this point in the history
CMake does a poor job in tracking dependencies on files and directories
directly. Create custom target similar to the configuration step.
On my system, this avoids the reconfiguration on each build.

Differential Revision: https://reviews.llvm.org/D39298

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317694 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
hahnjo committed Nov 8, 2017
1 parent a3ad9bd commit 41dfa19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmake/modules/CrossCompile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ function(llvm_create_cross_target_internal target_name toolchain buildtype)
COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_${target_name}_BUILD}
COMMENT "Creating ${LLVM_${target_name}_BUILD}...")

add_custom_target(CREATE_LLVM_${target_name}
DEPENDS ${LLVM_${target_name}_BUILD})

add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
-DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
DEPENDS ${LLVM_${target_name}_BUILD}
DEPENDS CREATE_LLVM_${target_name}
COMMENT "Configuring ${target_name} LLVM...")

add_custom_target(CONFIGURE_LLVM_${target_name}
Expand Down

0 comments on commit 41dfa19

Please sign in to comment.