vcpkg/ports/cspice/CMakeLists.txt

47 lines
1.4 KiB
CMake
Raw Normal View History

2019-11-21 06:04:54 +08:00
cmake_minimum_required(VERSION 3.1)
project(cspice LANGUAGES C)
set(SOVERSION 67)
2019-11-21 06:04:54 +08:00
# Include all *.c files from the library
file(GLOB CSPICE_SOURCE ${PROJECT_SOURCE_DIR}/cspice/src/cspice/*.c)
set(INCLUDE_PATH "${PROJECT_SOURCE_DIR}/cspice/include")
if (_STATIC_BUILD)
add_library(cspice STATIC ${CSPICE_SOURCE})
else()
add_library(cspice SHARED ${CSPICE_SOURCE})
endif()
target_include_directories(cspice PUBLIC "${INCLUDE_PATH}")
if (WIN32)
target_compile_definitions(cspice PUBLIC "_COMPLEX_DEFINED;MSDOS;OMIT_BLANK_CC;NON_ANSI_STDIO;_CRT_SECURE_NO_WARNINGS")
2019-11-21 06:04:54 +08:00
set_target_properties(cspice PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
elseif (UNIX)
2020-08-28 13:15:26 +08:00
target_compile_definitions(cspice PUBLIC "NON_UNIX_STDIO")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_options(cspice PUBLIC -m64 -ansi -fPIC)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_compile_options(cspice PUBLIC -m32 -ansi -fPIC)
endif()
target_compile_options(cspice PRIVATE -Wno-error=implicit-function-declaration)
2019-11-21 06:04:54 +08:00
endif ()
if (NOT _SKIP_HEADERS)
file(GLOB SPICE_HEADERS ${INCLUDE_PATH}/*.h)
install(FILES ${SPICE_HEADERS} DESTINATION include/cspice)
2019-11-21 06:04:54 +08:00
endif()
set_target_properties(
cspice
PROPERTIES SOVERSION ${SOVERSION}
)
install(
TARGETS cspice
EXPORT cspice
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)