Skip to content

Commit

Permalink
CMake: Enforce CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON with…
Browse files Browse the repository at this point in the history
… v3.27+
  • Loading branch information
kinke committed Jul 30, 2023
1 parent 5f96e18 commit 1860eae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ commonSteps: &commonSteps
-DCMAKE_BUILD_TYPE=Release \
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
-DLDC_LINK_MANUALLY=OFF \
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
$EXTRA_CMAKE_FLAGS
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 -version
Expand Down
4 changes: 1 addition & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
-DCMAKE_INSTALL_PREFIX=$installDir \
-DINCLUDE_INSTALL_DIR=$installDir/import \
-DLDC_LINK_MANUALLY=OFF \
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
"${extraFlags[@]}"
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 -version
Expand Down Expand Up @@ -406,8 +405,7 @@ task:
-DLLVM_ROOT_DIR=$PWD/../llvm \
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_LTO_LIBS=ON \
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON
-DBUILD_LTO_LIBS=ON
ninja -j$PARALLELISM obj/ldc2.o all
bin/ldc2 -version
<< : *COMMON_STEPS_TEMPLATE
Expand Down
2 changes: 0 additions & 2 deletions .github/actions/helper-build-ldc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ runs:
-DLLVM_ROOT_DIR="$PWD/../${{ inputs.llvm_dir }}" \
-DD_COMPILER='${{ inputs.host_dc }}' \
-DLDC_LINK_MANUALLY=OFF \
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
${{ inputs.specify_install_dir == 'true' && '-DCMAKE_INSTALL_PREFIX="$installDir"' || '' }} \
${{ inputs.specify_install_dir == 'true' && '-DINCLUDE_INSTALL_DIR="$installDir/import"' || '' }} \
${{ inputs.cmake_flags }}
Expand All @@ -58,7 +57,6 @@ runs:
"-DD_COMPILER=${{ inputs.host_dc }}" ^
-DCMAKE_C_COMPILER=clang-cl ^
-DCMAKE_CXX_COMPILER=clang-cl ^
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON ^
${{ inputs.specify_install_dir == 'true' && '"-DCMAKE_INSTALL_PREFIX=%installDir%"' || '' }} ^
${{ inputs.specify_install_dir == 'true' && '"-DINCLUDE_INSTALL_DIR=%installDir%\import"' || '' }} ^
${{ inputs.cmake_flags }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR="$PWD/llvm" \
-DLDC_LINK_MANUALLY=OFF \
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
${{ matrix.cmake_flags }}
ninja obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 --version
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.4.3)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
cmake_policy(SET CMP0025 NEW)
endif()
if(${CMAKE_VERSION} VERSION_GREATER "3.26.9")
# Prevent implicit dependencies for custom commands, e.g.,
# `obj/ldc2.o` depending on `lib/libldc.a` with LDC_LINK_MANUALLY=ON.
# Only supported since CMake v3.27 unfortunately.
set(CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY ON)
endif()

project(ldc)
Expand Down

0 comments on commit 1860eae

Please sign in to comment.