diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/sproto/CMakeLists.txt | |
Diffstat (limited to 'vcpkg/ports/sproto/CMakeLists.txt')
| -rw-r--r-- | vcpkg/ports/sproto/CMakeLists.txt | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/vcpkg/ports/sproto/CMakeLists.txt b/vcpkg/ports/sproto/CMakeLists.txt new file mode 100644 index 0000000..d5a1bae --- /dev/null +++ b/vcpkg/ports/sproto/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.14) +project(sproto C) + +set(CMAKE_C_STANDARD 99) + +find_package(unofficial-lua CONFIG REQUIRED) + +add_library(sproto sproto.c lsproto.c) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(sproto PRIVATE SPROTO_BUILD_DLL) + # Set symbol visibility for GCC/Clang + if(NOT WIN32) + target_compile_options(sproto PRIVATE -fvisibility=hidden) + endif() +else() + target_compile_definitions(sproto PUBLIC SPROTO_STATIC) +endif() + +target_link_libraries(sproto PRIVATE lua) + +target_include_directories(sproto PRIVATE ${LUA_INCLUDE_DIR}) + +target_include_directories(sproto PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> + $<INSTALL_INTERFACE:include> +) + +install(TARGETS sproto + EXPORT sproto-targets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) + +install(FILES sproto.h + DESTINATION include +) + +install(EXPORT sproto-targets + FILE sproto-targets.cmake + NAMESPACE unofficial::sproto:: + DESTINATION share/unofficial-sproto +) + +include(CMakePackageConfigHelpers) +configure_package_config_file( + "${CMAKE_CURRENT_LIST_DIR}/sproto-config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-sproto-config.cmake" + INSTALL_DESTINATION share/unofficial-sproto +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-sproto-config.cmake" + DESTINATION share/unofficial-sproto +) |