mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-11 17:19:07 +08:00
1dddccf0c3
- [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [ ] ~~SHA512s are updated for each updated download.~~ - [ ] ~~The "supports" clause reflects platforms that may be fixed by this new version.~~ - [ ] ~~Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file.~~ - [ ] ~~Any patches that are no longer applied are deleted from the port's directory.~~ - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. Fix for excluding the `predicates_init.c` file from the build: - fix typo `predicate_init.c` -> `predicates_init.c` - use regex to filter out the file such that we can use a relative path to filter out the file.
48 lines
1.4 KiB
CMake
48 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
|
|
project(gts VERSION "${VERSION}" LANGUAGES C)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(GLIB2 glib-2.0 IMPORTED_TARGET)
|
|
|
|
if(WIN32)
|
|
add_definitions(-DNATIVE_WIN32 -D_USE_MATH_DEFINES)
|
|
else()
|
|
include(CheckIncludeFile)
|
|
check_include_file("fpu_control.h" HAVE_FPU_CONTROL_H)
|
|
if(HAVE_FPU_CONTROL_H)
|
|
add_definitions(-DHAVE_FPU_CONTROL_H)
|
|
endif()
|
|
endif()
|
|
|
|
add_definitions(
|
|
-DGTS_COMPILATION
|
|
-DGTS_MAJOR_VERSION=${PROJECT_VERSION_MAJOR}
|
|
-DGTS_MINOR_VERSION=${PROJECT_VERSION_MINOR}
|
|
-DGTS_MICRO_VERSION=${PROJECT_VERSION_PATCH}
|
|
-DGTS_INTERFACE_AGE=1
|
|
-DGTS_BINARY_AGE=1
|
|
-DGTS_VERSION=${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
|
)
|
|
|
|
file(GLOB src src/*.c src/gts.def)
|
|
list(FILTER src EXCLUDE REGEX ".*predicates_init\\.c$")
|
|
add_library(gts ${src})
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "")
|
|
target_include_directories(gts PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
target_link_libraries(gts PUBLIC PkgConfig::GLIB2)
|
|
|
|
set(prefix ?)
|
|
set(exec_prefix \${prefix})
|
|
set(libdir \${prefix}/lib)
|
|
set(includedir \${prefix}/include)
|
|
configure_file(gts.pc.in gts.pc @ONLY)
|
|
|
|
install(FILES src/gts.h src/gtsconfig.h DESTINATION include)
|
|
install(TARGETS gts)
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gts.pc" DESTINATION lib/pkgconfig)
|