Skip to content

Commit

Permalink
cmake: set CMP0037 policy to NEW
Browse files Browse the repository at this point in the history
To fix deprecation warning, CMP0037 policy was changed to NEW for cmake
3.11 and above.

CMP0037 old behavior (cmake 2.8.12) allowed target names such as test.
In cmake 3.10 and below names test, help and etc. were reserved.

Starting from cmake 3.11 these names are only reserved when the
corresponding feature is enabled (e.g. by including the CTest or CPack
modules). Tarantool does not use CTest so the name test can be used.

Closes #3587

(cherry picked from commit a753f25)
  • Loading branch information
Olga Arkhangelskaia authored and Totktonada committed Jun 14, 2020
1 parent 4b61c98 commit e869fd1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ add_compile_flags("C;CXX"
"-Wno-unused-parameter")

if(POLICY CMP0037)
cmake_policy(SET CMP0037 OLD)
if(CMAKE_VERSION VERSION_LESS 3.11)
# cmake below 3.11 reserves name test. Use old policy.
# https://cmake.org/cmake/help/v3.11/release/3.11.html#other-changes
cmake_policy(SET CMP0037 OLD)
else()
# Starting from cmake 3.11 name test reserved in special
# cases and can be used as target name.
cmake_policy(SET CMP0037 NEW)
endif()
endif(POLICY CMP0037)

execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
Expand Down

0 comments on commit e869fd1

Please sign in to comment.