Use new CMake approach to check Visual C++

This commit is contained in:
Christophe Riccio 2017-01-04 22:31:25 +01:00
parent bf97e168d5
commit a39a9b8eb9

View File

@ -119,7 +119,7 @@ elseif(GLM_TEST_ENABLE_SIMD_AVX2)
add_definitions(-mavx2) add_definitions(-mavx2)
elseif(GLM_USE_INTEL) elseif(GLM_USE_INTEL)
add_definitions(/QxAVX2) add_definitions(/QxAVX2)
elseif(MSVC) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(/arch:AVX2) add_definitions(/arch:AVX2)
endif() endif()
message(STATUS "GLM: AVX2 instruction set") message(STATUS "GLM: AVX2 instruction set")
@ -128,7 +128,7 @@ elseif(GLM_TEST_ENABLE_SIMD_AVX)
add_definitions(-mavx) add_definitions(-mavx)
elseif(GLM_USE_INTEL) elseif(GLM_USE_INTEL)
add_definitions(/QxAVX) add_definitions(/QxAVX)
elseif(MSVC) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(/arch:AVX) add_definitions(/arch:AVX)
endif() endif()
message(STATUS "GLM: AVX instruction set") message(STATUS "GLM: AVX instruction set")
@ -137,7 +137,7 @@ elseif(GLM_TEST_ENABLE_SIMD_SSE3)
add_definitions(-msse3) add_definitions(-msse3)
elseif(GLM_USE_INTEL) elseif(GLM_USE_INTEL)
add_definitions(/QxSSE3) add_definitions(/QxSSE3)
elseif(MSVC AND NOT CMAKE_CL_64) elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") AND NOT CMAKE_CL_64)
add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3 add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3
endif() endif()
message(STATUS "GLM: SSE3 instruction set") message(STATUS "GLM: SSE3 instruction set")
@ -146,7 +146,7 @@ elseif(GLM_TEST_ENABLE_SIMD_SSE2)
add_definitions(-msse2) add_definitions(-msse2)
elseif(GLM_USE_INTEL) elseif(GLM_USE_INTEL)
add_definitions(/QxSSE2) add_definitions(/QxSSE2)
elseif(MSVC AND NOT CMAKE_CL_64) elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") AND NOT CMAKE_CL_64)
add_definitions(/arch:SSE2) add_definitions(/arch:SSE2)
endif() endif()
message(STATUS "GLM: SSE2 instruction set") message(STATUS "GLM: SSE2 instruction set")
@ -176,18 +176,10 @@ if (GLM_INSTALL_ENABLE)
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif() endif()
write_basic_package_version_file( write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" VERSION ${GLM_VERSION} COMPATIBILITY AnyNewerVersion)
"${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
VERSION ${GLM_VERSION}
COMPATIBILITY AnyNewerVersion
)
# build tree package config # build tree package config
configure_file( configure_file(cmake/glmBuildConfig.cmake.in glmConfig.cmake @ONLY)
cmake/glmBuildConfig.cmake.in
glmConfig.cmake
@ONLY
)
# install tree package config # install tree package config
configure_package_config_file( configure_package_config_file(
@ -195,52 +187,35 @@ configure_package_config_file(
${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake ${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake
INSTALL_DESTINATION ${GLM_INSTALL_CONFIGDIR} INSTALL_DESTINATION ${GLM_INSTALL_CONFIGDIR}
PATH_VARS CMAKE_INSTALL_INCLUDEDIR PATH_VARS CMAKE_INSTALL_INCLUDEDIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
)
if (GLM_INSTALL_ENABLE) if (GLM_INSTALL_ENABLE)
install( install(FILES
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
DESTINATION ${GLM_INSTALL_CONFIGDIR} DESTINATION ${GLM_INSTALL_CONFIGDIR})
)
endif() endif()
if (NOT CMAKE_VERSION VERSION_LESS "3.0") if (NOT CMAKE_VERSION VERSION_LESS "3.0")
add_library(glm INTERFACE) add_library(glm INTERFACE)
target_include_directories(glm INTERFACE target_include_directories(glm INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
)
install(TARGETS glm EXPORT glmTargets) install(TARGETS glm EXPORT glmTargets)
export( export(EXPORT glmTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake")
EXPORT glmTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake"
)
if (GLM_INSTALL_ENABLE) if (GLM_INSTALL_ENABLE)
install( install(EXPORT glmTargets FILE glmTargets.cmake DESTINATION ${GLM_INSTALL_CONFIGDIR})
EXPORT glmTargets FILE glmTargets.cmake
DESTINATION ${GLM_INSTALL_CONFIGDIR}
)
endif() endif()
endif() endif()
# build pkg-config file # build pkg-config file
configure_file( configure_file("./cmake/glm.pc.in" "glm.pc" @ONLY)
"./cmake/glm.pc.in"
"glm.pc"
@ONLY
)
# install pkg-config file # install pkg-config file
if (GLM_INSTALL_ENABLE) if (GLM_INSTALL_ENABLE)
install( install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glm.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
FILES "${CMAKE_CURRENT_BINARY_DIR}/glm.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
endif() endif()
export(PACKAGE glm) export(PACKAGE glm)