From c549192f590066782f7f97f0d5a7137d6178f52c Mon Sep 17 00:00:00 2001 From: Raymonf Date: Thu, 20 Aug 2020 15:59:54 -0400 Subject: [PATCH] CMake build support (#8) * CMake build support * Make things nice for VS users Co-authored-by: Raymonf --- .gitignore | 3 +++ CMakeLists.txt | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 8e9237c..ad152dc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ config.ini *.o tags *~ +CMakeFiles/ +CMakeCache.txt +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..cd30f33 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.16) +project(OpenFusion) + +set(CMAKE_CXX_STANDARD 17) + +# Disallow in-source builds +if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds not allowed. Please refer to the wiki for more information. Please remove the CMakeFiles folder and the CMakeCache.txt file.") +endif() + +# Output binaries to the bin folder in the source directory +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) + +# Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# Set the OpenFusion project as the default startup project for VS +set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT openfusion) + +include_directories(src) + +file(GLOB_RECURSE SOURCES src/**.cpp src/**.hpp) + +add_executable(openfusion ${SOURCES}) + +# Set the output binary name to winfusion to match the regular Makefile +set_target_properties(openfusion PROPERTIES OUTPUT_NAME winfusion)