After compiling my program with
$ cmake .
$ make
I get 5 errors of this form:
$ make
Scanning dependencies of target Project
[ 50%] Building CXX object CMakeFiles/myproj.dir/main.cpp.o
In file included from /path/to/my/proj/main.cpp:2:0:
/path/to/my/proj/library.hpp: In member function ‘virtual double MyProjClass::get_value(double, double) const’:
/path/to/my/proj/library.hpp:419:26: error: ‘sqrtf’ is not a member of ‘std’
const float F = (std::sqrtf(1.0f + 2.0f) - 1.0f) / 2;
^
Other errors include floorf
not being a member of std
.
Looking at this thread, it's because I'm not compiling with C++11, and looking at this thread thread, "[...] CMake will make sure the C++ compiler is invoked with the appropriate command line flags."
Well, my CMake is obviously not doing this. Why am I getting these errors, and how do I go about fixing them?
Edit: Here's my CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(Noise)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp vector.hpp noise.hpp)
add_executable(Noise ${SOURCE_FILES})
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
target_link_libraries(Noise ${SDL2_LIBRARIES})