samstyle / Xpeccy

Multiplatform emulator of retro computers
MIT License
71 stars 13 forks source link

Add C++-standard-related CMake options to the build system #109

Open ZanyXDev opened 3 years ago

ZanyXDev commented 3 years ago

https://github.com/samstyle/Xpeccy/blob/15c7cadbb271e99a0123e7d1b72726a8e02d35fb/CMakeLists.txt#L2

cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)

Enable C++11

set(CMAKE_CXX_STANDARD 11)

This makes C++11 a requirement and prevents a "decay" to C++98 when the compiler does not support C++11.

set(CMAKE_CXX_STANDARD_REQUIRED ON)

This disables the use of compiler-specific extensions.

For example, by default, CMake passes -std=gnu++11to GCC on Linux. We want to build with -std=c++11 to prevent use of non-portable compiler extensions, which is what the disabling of this option does.

set(CMAKE_CXX_EXTENSIONS OFF)

Allow multi core usage

set(CMAKE_BUILD_PARALLEL_LEVEL)