Hello,
my complete cmake file looks like that:
cmake_minimum_required (VERSION 3.1)
project(Preallocation)
add_executable(prealloc prealloc_parallel.cpp)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-std=c++11)
find_library(petsc petsc
PATHS $ENV{PETSC_DI
> On Jul 10, 2017, at 10:07 PM, Florian Lindner wrote:
>
> Hello,
>
> my complete cmake file looks like that:
>
> cmake_minimum_required (VERSION 3.1)
> project(Preallocation)
> add_executable(prealloc prealloc_parallel.cpp)
>
> set(CMAKE_CXX_STANDARD 11)
> set(CMAKE_CXX_STANDARD_REQUIRED ON)
As well as moving the add_executable() call after you set the various
CMAKE_CXX... variables, you should also replace the call to
add_compile_options(-std=c++11) with the following:
set(CMAKE_CXX_EXTENSIONS OFF)
On Tue, Jul 11, 2017 at 3:11 PM, Michael Ellery
wrote:
>
> > On Jul 10, 2017, at 1
As others have suggested, moving the add_executable() after the set() calls
is the correct solution.
The reason is that variables like CMAKE_CXX_STANDARD are used to
pre-initialise a target's properties when the target is created. In other
words, at the time add_executable() is called, CMake will