You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
1.8 KiB

# Detect Clang compiler
if("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
# Require C++11
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
# Compile-time type size checks
include(CheckTypeSize)
if(NOT WCHAR_BYTES)
check_type_size("wchar_t" WCHAR_BYTES)
if(NOT WCHAR_BYTES)
message(FATAL_ERROR "Could not determine sizeof(wchar_t)")
set(WCHAR_BYTES 0)
endif()
endif()
if(NOT SIZEOF_LONG)
check_type_size("long" SIZEOF_LONG)
if(NOT SIZEOF_LONG)
message(FATAL_ERROR "Could not determine sizeof(long)")
set(SIZEOF_LONG 0)
endif()
endif()
# Check for CPUID headers
try_compile(HAVE_CPUID ${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/check_cpuid.cpp
OUTPUT_VARIABLE OUTPUT)
if(HAVE_CPUID)
message("CPUID header found -- using hardware math acceleration when available")
else()
message("CPUID header not found -- using software math")
endif()
# Look for a supported "deprecated" attribute specifier.
try_compile(HAVE_CXX14_DEPRECATED_ATTR ${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/check_deprecated_attribute.cpp
COMPILE_DEFINITIONS -DTRY_ATTRIBUTE
OUTPUT_VARIABLE OUTPUT)
try_compile(HAVE_GCC_DEPRECATED_ATTR ${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/check_deprecated_attribute.cpp
COMPILE_DEFINITIONS -DTRY_GCC_ATTR
OUTPUT_VARIABLE OUTPUT)
configure_file(${PROJECT_SOURCE_DIR}/cmake/hsCompilerSpecific.h.cmake
${PROJECT_BINARY_DIR}/hsCompilerSpecific.h)
include_directories(${PROJECT_BINARY_DIR})