Skip to content

Commit 68cbf71

Browse files
committed
Simplify in-source disabling
- This prevents in-source builds to not bloat .gitignore file, but still allows adding this project via add_subdirectory(), or FetchContent/ExternalProject modules. Added before the project() call to have less configure steps done in this case. - Added installation step to CI. - Added missing BUILD_INTERFACE for sapi/embed.
1 parent db45e76 commit 68cbf71

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,7 @@ jobs:
136136
sudo systemctl restart dovecot
137137
138138
- name: Run tests
139-
run: |
140-
ctest --preset all-enabled
139+
run: ctest --preset all-enabled
140+
141+
- name: Install PHP
142+
run: cmake --install php-build/all-enabled

CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,7 @@ further information.
5757

5858
cmake_minimum_required(VERSION 3.25...3.31)
5959

60-
project(
61-
PhpBuildSystem
62-
VERSION 8.3
63-
DESCRIPTION "CMake-based PHP build system"
64-
HOMEPAGE_URL "https://github.com/petk/php-build-system"
65-
LANGUAGES NONE
66-
)
67-
68-
if(PROJECT_IS_TOP_LEVEL AND CMAKE_SOURCE_DIR PATH_EQUAL CMAKE_BINARY_DIR)
60+
if(CMAKE_BINARY_DIR PATH_EQUAL CMAKE_CURRENT_LIST_DIR)
6961
message(
7062
FATAL_ERROR
7163
"In-source builds are disabled. Please, set the build directory.\n"
@@ -75,6 +67,14 @@ if(PROJECT_IS_TOP_LEVEL AND CMAKE_SOURCE_DIR PATH_EQUAL CMAKE_BINARY_DIR)
7567
)
7668
endif()
7769

70+
project(
71+
PhpBuildSystem
72+
VERSION 8.3
73+
DESCRIPTION "CMake-based PHP build system"
74+
HOMEPAGE_URL "https://github.com/petk/php-build-system"
75+
LANGUAGES NONE
76+
)
77+
7878
# Configuration.
7979
block(PROPAGATE phpUrl)
8080
set(

cmake/sapi/embed/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ target_sources(
4747
target_link_libraries(
4848
php_sapi_embed
4949
PRIVATE
50-
PHP::sapi
50+
$<BUILD_INTERFACE:PHP::sapi>
5151
)
5252

5353
target_compile_definitions(php_sapi_embed PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)

0 commit comments

Comments
 (0)