Skip to content

Commit 0fa8330

Browse files
henryiiijcfr
andcommitted
fix: try supporting older CMake
Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
1 parent 24af886 commit 0fa8330

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151
- python-version: "3.9"
5252
runs-on: ubuntu-latest
5353
cmake: "3.20.x"
54+
- python-version: "3.10"
55+
runs-on: ubuntu-latest
56+
cmake: "3.15.x"
5457

5558
steps:
5659
- uses: actions/checkout@v4
@@ -67,6 +70,9 @@ jobs:
6770
with:
6871
cmake-version: ${{ matrix.cmake }}
6972

73+
- run: pipx install ninja
74+
if: matrix.cmake == '3.15.x'
75+
7076
- uses: yezz123/setup-uv@v4
7177

7278
- name: Install package

src/cython_cmake/cmake/UseCython.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
# limitations under the License.
6565
#=============================================================================
6666

67+
if(CMAKE_VERSION VERSION_LESS "3.7")
68+
message(SEND_ERROR "CMake 3.7 required for DEPFILE")
69+
endif()
6770

6871
function(Cython_compile_pyx)
6972
set(_options )
@@ -116,7 +119,11 @@ function(Cython_compile_pyx)
116119
set(generated_files)
117120

118121
foreach(_source_file IN LISTS _source_files)
119-
cmake_path(GET _source_file STEM _name)
122+
123+
# Can use cmake_path for CMake 3.20+
124+
# cmake_path(GET _source_file STEM _name)
125+
get_filename_component(_name "${_source_file}" NAME_WE)
126+
120127
set(generated_file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.${_language_extension}")
121128
set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE)
122129

0 commit comments

Comments
 (0)