mirror of
https://github.com/estkme-group/lpac
synced 2024-09-17 14:30:32 +02:00
Peter Cai
4095ab5a15
...based on option LPAC_DYNAMIC_LIBEUICC, defaults to OFF. This makes it possible to use libeuicc on Linux without submoduling. Note that this would require any future breaking change to increment the MAJOR version of the project in the main CMakeLists.txt. This version number is now a public interface and must be maintained. As part of this commit, I have modified the version code in CMakeLists to match the current release version.
27 lines
1.2 KiB
CMake
27 lines
1.2 KiB
CMake
option(LPAC_DYNAMIC_LIBEUICC "Build and install libeuicc as a dynamic library" OFF)
|
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} LIB_EUICC_SRCS)
|
|
if(LPAC_DYNAMIC_LIBEUICC)
|
|
add_library(euicc SHARED ${LIB_EUICC_SRCS})
|
|
else()
|
|
add_library(euicc STATIC ${LIB_EUICC_SRCS})
|
|
endif()
|
|
target_link_libraries(euicc cjson-static)
|
|
target_include_directories(euicc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
|
if(LPAC_DYNAMIC_LIBEUICC)
|
|
# Install headers
|
|
file(GLOB ALL_HEADERS "*.h")
|
|
foreach(header ${ALL_HEADERS})
|
|
if(${header} MATCHES "^.*\.private\.h$")
|
|
list(REMOVE_ITEM ALL_HEADERS ${header})
|
|
endif()
|
|
endforeach()
|
|
set_target_properties(euicc PROPERTIES PUBLIC_HEADER "${ALL_HEADERS}")
|
|
# Install a pkg-config file
|
|
configure_file(libeuicc.pc.in libeuicc.pc @ONLY)
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libeuicc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
# Configure libeuicc.so installation
|
|
set_target_properties(euicc PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
|
|
install(TARGETS euicc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/euicc)
|
|
endif()
|