feat: finish basic packer
- finish basic packer - add basic jinja2 template
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
{# Get the path to directory where current XXXConfig.cmake file is (i.e. /path/to/installation/lib/cmake/XXX) -#}
|
||||
get_filename_component(PACKAGE_CMAKE_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
{# Compute installation root directory (back to parent 3 times, i.e. /path/to/installation) -#}
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${PACKAGE_CMAKE_CONFIG_PATH}/../../../" ABSOLUTE)
|
||||
|
||||
{# Setup library and header file paths -#}
|
||||
set(MyRust_LIBRARY "${PACKAGE_PREFIX_DIR}/lib/ {{- artifact_filename -}} }")
|
||||
set(MyRust_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")
|
||||
|
||||
{# Create modern CMake target (IMPORTED target) -#}
|
||||
add_library(MyRust::MyRust SHARED IMPORTED)
|
||||
set_target_properties(MyRust::MyRust PROPERTIES
|
||||
IMPORTED_LOCATION "${MyRust_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MyRust_INCLUDE_DIR}"
|
||||
)
|
||||
|
||||
{# Handle the Windows-specific case that .dll is seperated with .lib -#}
|
||||
if(WIN32)
|
||||
set_target_properties(MyRust::MyRust PROPERTIES
|
||||
IMPORTED_IMPLIB "${PACKAGE_PREFIX_DIR}/lib/myrust.lib"
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,14 @@
|
||||
{# Setup package version -#}
|
||||
set(PACKAGE_VERSION "1.2.3") # TODO: replace with jinja argument
|
||||
|
||||
{# Check whether user request EXACT match -#}
|
||||
if(PACKAGE_FIND_VERSION_EXACT)
|
||||
if(NOT "${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_UNSUPPORTED TRUE)
|
||||
endif()
|
||||
else()
|
||||
{# Check whether user requested version is <= current version (compatible with new version) -#}
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_UNSUPPORTED TRUE)
|
||||
endif()
|
||||
endif()
|
||||
Reference in New Issue
Block a user