-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
58 lines (45 loc) · 1.41 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
cmake_minimum_required(VERSION 3.0.0)
# Set default build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
project(csswm VERSION 0.1.0)
# Set compiler
set(CMAKE_C_COMPILER "/home/Aaron/gcc13/bin/gcc")
set(CMAKE_CXX_COMPILER "/home/Aaron/gcc13/bin/g++")
# Set compiler flags
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Enable testing and export compile commands
include(CTest)
enable_testing()
set(CMAKE_EXPORT_COMPILE_COMMANDS True)
# Add local include directories
include_directories(
/home/Aaron/local/include
./include
)
# Add an option for PETSc support
option(USE_PETSC "Enable PETSc support" OFF)
# Include PETSc if USE_PETSC is ON
if(USE_PETSC)
message(STATUS "PETSc support enabled.")
find_package(PETSc REQUIRED)
include_directories(${PETSC_INCLUDES})
set(LIBS ${LIBS} ${PETSC_LIBRARIES})
else()
message(STATUS "PETSc support disabled.")
endif()
# Source files
file(GLOB_RECURSE SRC src/*.cpp src/*.hpp)
# Add the executable target
add_executable(csswm ${SRC})
# Link libraries
find_library(libncPath netcdf "/home/Aaron/local/lib")
find_library(libncxxPath netcdf_c++4 "/home/Aaron/local/lib")
target_link_libraries(csswm ${libncPath} ${libncxxPath} ${LIBS})
# CPack settings
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)