Skip to content

tribits: Removed code that included CMAKE_CXX_FLAGS twice in tests for C++11 compilers flags

James Willenbring requested to merge kddevin:master into master

Created by: kddevin

The CMake tests for the appropriate C++11 compiler flags (e.g., --std=c++11) had been including CMAKE_CXX_FLAGS twice because CMAKE_CXX_FLAGS was added to CMAKE_REQUIRED_FLAGS in this file. While in many cases duplicating the flags is not a problem, it can cause errors in when, for example, building an MPI code without using the MPI wrappers. I build mpi-enabled executables under purify by (1) disabling MPI wrappers; (2) specifying purify as the C++ compiler; and (3) specifying purify options first in CMAKE_CXX_FLAGS, followed by the gcc compiler path and gcc compiler flags. With CMake duplicating the flags for this test, the purify options in CMAKE_CXX_FLAGS were passed to the compiler and were, of course, unrecognized, causing the C++11 test to fail. Removing the duplication prevented the unrecognized options and allowed the C++11 test to work as expected.

Removing the duplication does not hurt my other builds; for example, my MPI build with MPI wrappers still works.

@bartlettroscoe @jwillenbring @bmpersc @maherou @kddevin

Merge request reports