Skip to content

Commit

Permalink
Update and modernize some aspects of CMake (KhronosGroup#92)
Browse files Browse the repository at this point in the history
* Update and modernize some aspects of CMake

Ease integration with projects targeting more recent CMake versions:

* Update minimum required CMake version to 3.1.
* Specify a version `1.2` to the `project` CMake command, this silences
  developer warnings when the OpenCL-ICD-Loader is integrated in another
  project using `add_subdirectory`.
* Specify include directory on the `OpenCL` target, this removes the
  need to set the OpenCL-Headers include directory globally (old CMake)
  or set them manually per target which links the `OpenCL` target
  library.

* Update AppVeyor project config
  • Loading branch information
kbenzie authored Jun 25, 2020
1 parent bbdf079 commit e546244
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ before_build:
- cmake -DOPENCL_ICD_LOADER_HEADERS_DIR=inc/OpenCL-Headers -H. -Bbuild -A%PLATFORM%

build:
project: build\OPENCL_ICD_LOADER.sln
project: build\OpenCL-ICD-Loader.sln
parallel: true
verbosity: normal
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 2.8.11)
cmake_minimum_required (VERSION 3.1)

project (OPENCL_ICD_LOADER)
project (OpenCL-ICD-Loader VERSION 1.2)
include (GNUInstallDirs)
find_package (Threads REQUIRED)

Expand Down Expand Up @@ -108,6 +108,7 @@ set (OPENCL_ICD_LOADER_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc CACHE PATH "P

add_library (OpenCL ${OPENCL_ICD_LOADER_SOURCES})
set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1")
target_include_directories(OpenCL SYSTEM PUBLIC ${OPENCL_ICD_LOADER_HEADERS_DIR})

if (WIN32)
target_link_libraries (OpenCL cfgmgr32.lib runtimeobject.lib)
Expand Down

0 comments on commit e546244

Please sign in to comment.