From 2967b1d7051a0377bf0ed7fc7fafdf10890b2d44 Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Tue, 30 Apr 2019 16:20:45 +0200 Subject: [PATCH] cl22: CMake improvements (#237) * Do not append non-existing folder to CMAKE_MODULE_PATH Fixes #221 * Define CL_TARGET_OPENCL_VERSION to 220 Fixes #227 * Define cmake_minimum_required as first operation The CMake documentation mentions that > Call the cmake_minimum_required() command at the beginning of the > top-level CMakeLists.txt file even before calling the project() > command. It is important to establish version and policy settings > before invoking other commands whose behavior they may affect. * CMake: Match both AppleClang and Clang --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fff8649a..139e0b0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.1) + set( CONFORMANCE_SUFFIX "" ) set(CLConform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -17,7 +19,7 @@ set(CLConform_VERSION "${CLConform_VERSION_MAJOR}.${CLConform_VERSION_MINOR}") set(CLConform_VERSION_FULL "${CLConform_VERSION}.${CLConform_VERSION_MICRO}${CLConform_VERSION_EXTRA}") -cmake_minimum_required(VERSION 3.1) +add_definitions(-DCL_TARGET_OPENCL_VERSION=220) add_definitions(-DCL_USE_DEPRECATED_OPENCL_2_1_APIS=1) add_definitions(-DCL_USE_DEPRECATED_OPENCL_2_0_APIS=1) @@ -25,9 +27,6 @@ add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_2_APIS=1) add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS=1) add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_0_APIS=1) -# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) - # Support both VS2008 and VS2012. set(BUILD_DIR "$ENV{ADRENO_DRIVER}/build") @@ -122,7 +121,7 @@ endif(CL_INCLUDE_DIR AND CL_LIB_DIR AND CL_LIBCLCXX_DIR) include(CheckFunctionExists) include(CheckIncludeFiles) -if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") # -msse -mfpmath=sse to force gcc to use sse for float math, # avoiding excess precision problems that cause tests like int2float # to falsely fail. -ffloat-store also works, but WG suggested