Commit 6c36c147 authored by Berenger Bramas's avatar Berenger Bramas

Update the cmake to avoid adding C11 flag if used as a sub-project

parent c9b606fa
......@@ -86,7 +86,11 @@ if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64le")
set(ALTIVEC_CPU_RULES "")
set(INASTEMP_USE_SCALAR ON)
set(INASTEMP_CXX_FLAGS "-std=c++11")
if(NOT INASTEMP_AS_SUBPROJECT)
set(INASTEMP_CXX_FLAGS "-std=c++11")
else()
set(INASTEMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${CMAKE_PROJECT_NAME}_CXX_FLAGS}")
endif()
else()
if($ENV{VERBOSE})
MESSAGE(STATUS "Main -- compile for x86 architecture")
......@@ -102,7 +106,11 @@ else()
# All types from worse to best (ADD-NEW-HERE)
set(ALL_TYPES "SSE3;SSSE3;SSE41;SSE42;AVX;AVX2;AVX512COMMON;AVX512KNL;AVX512SKL")
set(INASTEMP_USE_SCALAR ON)
set(INASTEMP_CXX_FLAGS "-std=c++11")
if(NOT INASTEMP_AS_SUBPROJECT)
set(INASTEMP_CXX_FLAGS "-std=c++11")
else()
set(INASTEMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${CMAKE_PROJECT_NAME}_CXX_FLAGS}")
endif()
# Set custom cpu <=> vec rules (maybe ADD-NEW-HERE if needed)
set(AVX512COMMON_CPU_RULES "AVX512F;AVX512ER")
......
......@@ -143,7 +143,7 @@ The inclusion of Inastemp as a subproject does not modify the variables of the u
This is why we use the variables `${INASTEMP_CXX_FLAGS}` explicitly to transfer the hardware specific flags.
When Inastemp detects it is included as a subproject, it turns the variable `INASTEMP_AS_SUBPROJECT` to `ON` and minimizes the additional flags.
As a result, the variable `INASTEMP_CXX_FLAGS` will contain a flag for `C++11` and `-funroll-loops` (from `INASTEMP_EXTRA_CXX_FLAGS`), plus the flags needed for the target instructions.
As a result, the variable `INASTEMP_CXX_FLAGS` will not contain a flag for `C++11` (a recent standard must be enable before inastemp inclusion), but it will contain `-funroll-loops` (from `INASTEMP_EXTRA_CXX_FLAGS`), plus the flags needed for the target instructions.
Such that, if one wants to compile only some files with these specific flags, it must use `INASTEMP_CXX_FLAGS` carefully.
### Compilers support
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment