1 cmake_minimum_required(VERSION 3.1)
2 project(cspice LANGUAGES C)
6 # Include all *.c files from the library
7 file(GLOB CSPICE_SOURCE ${PROJECT_SOURCE_DIR}/cspice/src/cspice/*.c)
8 set(INCLUDE_PATH "${PROJECT_SOURCE_DIR}/cspice/include")
11 add_library(cspice STATIC ${CSPICE_SOURCE})
13 add_library(cspice SHARED ${CSPICE_SOURCE})
15 target_include_directories(cspice PUBLIC "${INCLUDE_PATH}")
18 target_compile_definitions(cspice PUBLIC "_COMPLEX_DEFINED;MSDOS;OMIT_BLANK_CC;NON_ANSI_STDIO")
19 set_target_properties(cspice PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
21 target_compile_definitions(cspice PUBLIC "NON_UNIX_STDIO")
22 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
23 target_compile_options(cspice PUBLIC -m64 -ansi -fPIC)
24 elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
25 target_compile_options(cspice PUBLIC -m32 -ansi -fPIC)
27 target_compile_options(cspice PRIVATE -Wno-error=implicit-function-declaration)
30 if (NOT _SKIP_HEADERS)
31 file(GLOB SPICE_HEADERS ${INCLUDE_PATH}/*.h)
32 install(FILES ${SPICE_HEADERS} DESTINATION include/cspice)
35 set_target_properties(
37 PROPERTIES SOVERSION ${SOVERSION}
43 ARCHIVE DESTINATION lib
44 LIBRARY DESTINATION lib
45 RUNTIME DESTINATION bin