Skip to content

Commit 5ec2f7f

Browse files
committed
add cmake file
1 parent 2712726 commit 5ec2f7f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# cspell:disable
2+
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
3+
4+
set(VER_MAJ 0) # major
5+
set(VER_MIN 9) # minor
6+
set(VER_PAT 10) # patch
7+
set(VER_SS ${VER_MAJ}.${VER_MIN}.${VER_PAT})
8+
message("Version: ${VER_SS}")
9+
10+
project(cx_pal VERSION ${VER_SS})
11+
12+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
13+
add_definitions(-DPACKAGE_VERSION="${VER_SS}")
14+
add_definitions(-DPACKAGE_VERSION_INTEGER=${VER_MAJ})
15+
16+
set(CMAKE_BUILD_TYPE Release)
17+
18+
find_package(PkgConfig)
19+
pkg_check_modules(Erfa REQUIRED erfa>=1.7)
20+
21+
set(CMAKE_INSTALL_PREFIX $ENV{HOME}/software/install/)
22+
23+
include_directories(${PROJECT_SOURCE_DIR}/)
24+
25+
file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c)
26+
file(GLOB headers ${PROJECT_SOURCE_DIR}/*.h)
27+
28+
set(LINK_LIBS erfa)
29+
30+
add_library(pal SHARED ${sources} ${headers})
31+
target_link_libraries(pal ${LINK_LIBS})
32+
set_target_properties(pal PROPERTIES VERSION ${VER_SS} SOVERSION
33+
${VER_MAJ})
34+
install(FILES ${headers} DESTINATION include/star)
35+
install(
36+
TARGETS pal
37+
RUNTIME DESTINATION bin/
38+
LIBRARY DESTINATION lib/
39+
ARCHIVE DESTINATION lib/)

0 commit comments

Comments
 (0)