Fixed conen intergation in CMake and added '-march=native' switch
This commit is contained in:
parent
9d40aa3aab
commit
cb8b5e6d4b
|
@ -24,6 +24,12 @@ set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
||||||
|
endif()
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(warnings "-Wall -Wextra -Werror")
|
set(warnings "-Wall -Wextra -Werror")
|
||||||
set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0")
|
set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0")
|
||||||
|
|
|
@ -25,19 +25,21 @@ macro(setup_conan)
|
||||||
set(conanfile_cmake ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
set(conanfile_cmake ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||||
set(compiler_libcxx libstdc++11)
|
set(compiler_libcxx libstdc++11)
|
||||||
|
|
||||||
if(${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo)
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||||
execute_process(COMMAND ${conan} install --build=missing
|
set(CONAN_BUILD_TYPE Debug)
|
||||||
-s build_type=Release -s compiler.libcxx=${compiler_libcxx}
|
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||||
${CMAKE_SOURCE_DIR} RESULT_VARIABLE return_code)
|
set(CONAN_BUILD_TYPE Release)
|
||||||
else()
|
else()
|
||||||
execute_process(COMMAND ${conan} install --build=missing
|
set(CONAN_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
||||||
-s build_type=${CMAKE_BUILD_TYPE} -s compiler.libcxx=${compiler_libcxx}
|
|
||||||
${CMAKE_SOURCE_DIR} RESULT_VARIABLE return_code)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND ${conan} install --build=missing
|
||||||
|
-s build_type=${CONAN_BUILD_TYPE} -s compiler.libcxx=${compiler_libcxx}
|
||||||
|
${CMAKE_SOURCE_DIR} RESULT_VARIABLE return_code)
|
||||||
if(NOT ${return_code} EQUAL 0)
|
if(NOT ${return_code} EQUAL 0)
|
||||||
message(FATAL_ERROR "conan install command failed.")
|
message(FATAL_ERROR "conan install command failed.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(${conanfile_cmake})
|
include(${conanfile_cmake})
|
||||||
conan_basic_setup(TARGETS)
|
conan_basic_setup(TARGETS)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
Loading…
Reference in New Issue