31 lines
927 B
CMake
31 lines
927 B
CMake
# Specify the minimum required version of CMake
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# Set the project name and version
|
|
project(MessiVsRonaldo VERSION 1.0)
|
|
|
|
# Specify the C++ standard (e.g., C++17)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
# Set the output directory for the executable
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
|
|
# Automatically find all .cpp files in the src directory
|
|
file(GLOB SOURCES "src/*.cpp")
|
|
|
|
# Add an executable target
|
|
add_executable(MessiVsRonaldo ${SOURCES})
|
|
|
|
# Include the "include" directory (if you have header files)
|
|
target_include_directories(MessiVsRonaldo PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
# Find the X11 library
|
|
find_package(X11 REQUIRED)
|
|
target_link_libraries(MessiVsRonaldo ${X11_LIBRARIES})
|
|
endif()
|