Skip to content

Commit 1860eae

Browse files
committed
CMake: Enforce CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON with v3.27+
1 parent 5f96e18 commit 1860eae

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ commonSteps: &commonSteps
7979
-DCMAKE_BUILD_TYPE=Release \
8080
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
8181
-DLDC_LINK_MANUALLY=OFF \
82-
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
8382
$EXTRA_CMAKE_FLAGS
8483
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
8584
bin/ldc2 -version

.cirrus.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
2626
-DCMAKE_INSTALL_PREFIX=$installDir \
2727
-DINCLUDE_INSTALL_DIR=$installDir/import \
2828
-DLDC_LINK_MANUALLY=OFF \
29-
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
3029
"${extraFlags[@]}"
3130
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
3231
bin/ldc2 -version
@@ -406,8 +405,7 @@ task:
406405
-DLLVM_ROOT_DIR=$PWD/../llvm \
407406
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
408407
-DBUILD_SHARED_LIBS=OFF \
409-
-DBUILD_LTO_LIBS=ON \
410-
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON
408+
-DBUILD_LTO_LIBS=ON
411409
ninja -j$PARALLELISM obj/ldc2.o all
412410
bin/ldc2 -version
413411
<< : *COMMON_STEPS_TEMPLATE

.github/actions/helper-build-ldc/action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ runs:
3535
-DLLVM_ROOT_DIR="$PWD/../${{ inputs.llvm_dir }}" \
3636
-DD_COMPILER='${{ inputs.host_dc }}' \
3737
-DLDC_LINK_MANUALLY=OFF \
38-
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
3938
${{ inputs.specify_install_dir == 'true' && '-DCMAKE_INSTALL_PREFIX="$installDir"' || '' }} \
4039
${{ inputs.specify_install_dir == 'true' && '-DINCLUDE_INSTALL_DIR="$installDir/import"' || '' }} \
4140
${{ inputs.cmake_flags }}
@@ -58,7 +57,6 @@ runs:
5857
"-DD_COMPILER=${{ inputs.host_dc }}" ^
5958
-DCMAKE_C_COMPILER=clang-cl ^
6059
-DCMAKE_CXX_COMPILER=clang-cl ^
61-
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON ^
6260
${{ inputs.specify_install_dir == 'true' && '"-DCMAKE_INSTALL_PREFIX=%installDir%"' || '' }} ^
6361
${{ inputs.specify_install_dir == 'true' && '"-DINCLUDE_INSTALL_DIR=%installDir%\import"' || '' }} ^
6462
${{ inputs.cmake_flags }}

.github/workflows/supported_llvm_versions.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ jobs:
121121
-DCMAKE_BUILD_TYPE=Release \
122122
-DLLVM_ROOT_DIR="$PWD/llvm" \
123123
-DLDC_LINK_MANUALLY=OFF \
124-
-DCMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY=ON \
125124
${{ matrix.cmake_flags }}
126125
ninja obj/ldc2.o all ldc2-unittest all-test-runners
127126
bin/ldc2 --version

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
cmake_minimum_required(VERSION 3.4.3)
22
if(POLICY CMP0025)
3-
cmake_policy(SET CMP0025 NEW)
3+
cmake_policy(SET CMP0025 NEW)
4+
endif()
5+
if(${CMAKE_VERSION} VERSION_GREATER "3.26.9")
6+
# Prevent implicit dependencies for custom commands, e.g.,
7+
# `obj/ldc2.o` depending on `lib/libldc.a` with LDC_LINK_MANUALLY=ON.
8+
# Only supported since CMake v3.27 unfortunately.
9+
set(CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY ON)
410
endif()
511

612
project(ldc)

0 commit comments

Comments
 (0)