update cmakelists

This commit is contained in:
张壹 2021-08-22 08:19:37 +08:00
parent 34e5069f62
commit e071420a86

View File

@ -4,27 +4,25 @@ project(GMT_API_EX VERSION 0.1.0 LANGUAGES CXX)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME}) message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
include_directories(/usr/local/include/gmt) include_directories(/usr/include)
find_library(GMT_LIB gmt /usr/local/lib) find_library(GMT_LIB gmt /usr/lib/x86_64-linux-gnu)
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME}) message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
include_directories(/usr/local/include/gmt) include_directories(/opt/homebrew/include)
find_library(GMT_LIB gmt /usr/local/lib) find_library(GMT_LIB gmt /usr/homebrew/lib)
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME}) message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
set(CMAKE_C_COMPILER gcc) include_directories(C:/programs/gmt6/include)
set(CMAKE_CXX_COMPILER g++)
include_directories(C:/programs/gmt6/include/gmt)
find_library(GMT_LIB gmt C:/programs/gmt6/lib) find_library(GMT_LIB gmt C:/programs/gmt6/lib)
else() else()
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME}) message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
include_directories(/usr/local/include/gmt) include_directories(/usr/local/include)
find_library(GMT_LIB gmt /usr/local/lib) find_library(GMT_LIB gmt /usr/local/lib)
endif() endif()
message(STATUS "GMT library found as: " ${GMT_LIB}) message(STATUS "GMT library found as: " ${GMT_LIB})
macro(add_example name file) macro(add_example name file)
include_directories(/opt/homebrew/include)
add_executable(${name} ${file}.cpp) add_executable(${name} ${file}.cpp)
if(WIN32) if(WIN32)
target_link_libraries(${name} PRIVATE ${GMT_LIB}) target_link_libraries(${name} PRIVATE ${GMT_LIB})