diff --git a/CMakeLists.txt b/CMakeLists.txt index 169ae92..4000f2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/passpredict/CMakeLists.txt b/passpredict/CMakeLists.txt index 5d6cf00..9975e9d 100644 --- a/passpredict/CMakeLists.txt +++ b/passpredict/CMakeLists.txt @@ -4,5 +4,4 @@ set(SRCS add_executable(passpredict ${SRCS}) target_link_libraries(passpredict - sgp4 - rt) + sgp4) diff --git a/runtest/CMakeLists.txt b/runtest/CMakeLists.txt index 7a1cf26..621d56c 100644 --- a/runtest/CMakeLists.txt +++ b/runtest/CMakeLists.txt @@ -4,5 +4,4 @@ set(SRCS add_executable(runtest ${SRCS}) target_link_libraries(runtest - sgp4 - rt) + sgp4) diff --git a/sattrack/CMakeLists.txt b/sattrack/CMakeLists.txt index 0664458..a8c5027 100644 --- a/sattrack/CMakeLists.txt +++ b/sattrack/CMakeLists.txt @@ -4,5 +4,4 @@ set(SRCS add_executable(sattrack ${SRCS}) target_link_libraries(sattrack - sgp4 - rt) + sgp4)