Skip to content

Commit

Permalink
Avoid error when using CMake pre-3.0.
Browse files Browse the repository at this point in the history
Check for policy CMP0042.  If it is not known, don't try to set it.
This check-before-set idiom is suggested by the CMake documentation.
See <https://cmake.org/cmake/help/v3.0/manual/cmake-policies.7.html>.

Without this check, CMake pre-3.0 gives an error.

BTW, did you know that CMake 2.8 is the default on CentOS 7.3?
  • Loading branch information
eeide committed Jun 24, 2017
1 parent b775099 commit eaaabcf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion runtime/CMakeLists.txt
Expand Up @@ -32,7 +32,10 @@
cmake_minimum_required(VERSION 2.8.12)
project(csmith_runtime)

cmake_policy(SET CMP0042 NEW) # Quiet warning about shared libs on OS X.
# CMP0042 was introduced in CMake 3.0. Don't error in older CMakes.
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) # Quiet warning about shared libs on OS X.
endif()

set(INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/csmith-${csmith_VERSION}")
set(LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
Expand Down

0 comments on commit eaaabcf

Please sign in to comment.