Skip to content

Instantly share code, notes, and snippets.

@sergeyklay
Last active December 21, 2024 08:47
Show Gist options
  • Save sergeyklay/2a524d44a722528a01fd27d402fa94ba to your computer and use it in GitHub Desktop.
Save sergeyklay/2a524d44a722528a01fd27d402fa94ba to your computer and use it in GitHub Desktop.
CMakeLists.txt for PHP-extension. This CMake file is just for syntax highlighting in CLion.
cmake_minimum_required(VERSION 3.5)
project(extname
VERSION 1.0.0
LANGUAGES C)
message(STATUS "Begin cmaking of PHP extension ...")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
if (NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif ()
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -O0 -Wall -std=gnu99 -fvisibility=hidden")
set(PHP_VERSION 7.2.9)
get_filename_component(PHP_SRC_PATH "~/src/php/source/${PHP_VERSION}" ABSOLUTE)
include_directories(
"${PHP_SRC_PATH}"
"${PHP_SRC_PATH}/main"
"${PHP_SRC_PATH}/Zend"
"${PHP_SRC_PATH}/TSRM"
"${PHP_SRC_PATH}/ext"
"${PHP_SRC_PATH}/sapi")
FILE(GLOB KernelHeaders ./kernel/*.h)
FILE(GLOB KernelSources ./kernel/*.c)
set(SOURCE_FILES
php_extname.c
php_extname.h
${KernelHeaders}
${KernelSources})
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/config.h")
add_definitions(-DHAVE_CONFIG_H)
set(SOURCE_FILES "${SOURCE_FILES};config.h")
endif()
add_library(extname SHARED
${SOURCE_FILES})
message(STATUS "End cmaking of PHP extension")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment