mirror of
https://git.planet-casio.com/Lephenixnoir/libprof.git
synced 2024-12-28 04:23:41 +01:00
add version and a find_package() module
This commit is contained in:
parent
91bb658d6c
commit
6b5685a35e
3 changed files with 30 additions and 7 deletions
|
@ -2,16 +2,20 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(libprof VERSION 2.2.1 LANGUAGES C)
|
project(libprof VERSION 2.2.1 LANGUAGES C)
|
||||||
|
|
||||||
find_package(Gint 2.2.1 REQUIRED)
|
find_package(Gint 2.2.1 REQUIRED)
|
||||||
|
|
||||||
add_compile_options(-Wall -Wextra -std=c11 -Os)
|
configure_file(libprof.h libprof.h)
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
|
|
||||||
|
|
||||||
set(NAME "prof-${FXSDK_PLATFORM}")
|
set(NAME "prof-${FXSDK_PLATFORM}")
|
||||||
add_library("${NAME}" STATIC libprof.c)
|
add_library(${NAME} STATIC libprof.c)
|
||||||
target_link_libraries("${NAME}" Gint::Gint)
|
|
||||||
|
|
||||||
install(TARGETS "${NAME}" DESTINATION "${FXSDK_COMPILER_INSTALL}")
|
target_compile_options(${NAME} PUBLIC -Wall -Wextra -std=c11 -Os)
|
||||||
install(FILES libprof.h DESTINATION "${FXSDK_COMPILER_INSTALL}/include")
|
target_include_directories(${NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
target_link_libraries(${NAME} Gint::Gint)
|
||||||
|
|
||||||
|
install(TARGETS ${NAME}
|
||||||
|
DESTINATION "${FXSDK_COMPILER_INSTALL}")
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libprof.h"
|
||||||
|
DESTINATION "${FXSDK_COMPILER_INSTALL}/include")
|
||||||
|
install(FILES cmake/FindLibProf.cmake
|
||||||
|
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")
|
||||||
|
|
16
cmake/FindLibProf.cmake
Normal file
16
cmake/FindLibProf.cmake
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
include(FindSimpleLibrary)
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_simple_library("libprof-${FXSDK_PLATFORM}.a" include/libprof.h
|
||||||
|
"PROF_VERSION" PATH_VAR PROF_PATH VERSION_VAR PROF_VERSION)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(LibProf
|
||||||
|
REQUIRED_VARS PROF_PATH PROF_VERSION
|
||||||
|
VERSION_VAR PROF_VERSION)
|
||||||
|
|
||||||
|
if(LibProf_FOUND)
|
||||||
|
add_library(LibProf::LibProf UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(LibProf::LibProf PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PROF_PATH}"
|
||||||
|
INTERFACE_LINK_OPTIONS -lprof-${FXSDK_PLATFORM})
|
||||||
|
endif()
|
|
@ -8,6 +8,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <gint/defs/attributes.h>
|
#include <gint/defs/attributes.h>
|
||||||
|
|
||||||
|
/* This is substituted by CMake at compile-time */
|
||||||
|
#define PROF_VERSION "@libprof_VERSION@"
|
||||||
|
|
||||||
//---
|
//---
|
||||||
// Initialization
|
// Initialization
|
||||||
//---
|
//---
|
||||||
|
|
Loading…
Reference in a new issue