Support building on Windows with Visual Studio (#21)
* Remove lib rt, as not available on Windows, and doesn't seem to be required on CentOS 7 or Mac * Update CMakeLists.txt so it supports MSVC * Add support for CMake 2.8 * Export all symbols in DLLs on Windows * Simplify by removing support for CMake prior to version 3.13.4feature/19 v1.0
parent
f5cb54b382
commit
944f8d842a
|
@ -1,24 +1,28 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.13.4)
|
||||
PROJECT(SGP4)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
else()
|
||||
message(SEND_ERROR "The compiler ${CMAKE_CXX_COMPILER} doesnt support C++11.")
|
||||
if (POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion")
|
||||
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion")
|
||||
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
include_directories(libsgp4)
|
||||
|
||||
|
|
|
@ -4,5 +4,4 @@ set(SRCS
|
|||
add_executable(passpredict
|
||||
${SRCS})
|
||||
target_link_libraries(passpredict
|
||||
sgp4
|
||||
rt)
|
||||
sgp4)
|
||||
|
|
|
@ -4,5 +4,4 @@ set(SRCS
|
|||
add_executable(runtest
|
||||
${SRCS})
|
||||
target_link_libraries(runtest
|
||||
sgp4
|
||||
rt)
|
||||
sgp4)
|
||||
|
|
|
@ -4,5 +4,4 @@ set(SRCS
|
|||
add_executable(sattrack
|
||||
${SRCS})
|
||||
target_link_libraries(sattrack
|
||||
sgp4
|
||||
rt)
|
||||
sgp4)
|
||||
|
|
Loading…
Reference in New Issue