]> OCCT Git - occt.git/commit
0032921: require minimum CMAKE version 3.1 (for enabling CMAKE_CXX_STANDARD)
authorddzama <dmitry.dzama@opencascade.com>
Fri, 8 Apr 2022 11:43:59 +0000 (14:43 +0300)
committerddzama <ddzama@opencascade.com>
Mon, 29 Aug 2022 09:47:38 +0000 (12:47 +0300)
commit8271ac67280aa7a22828d619bd320e4af8701002
tree4663d716c3efcef92e4da8a2adbb8793ce1ee702
parent293b9f436b5001bad5a5ca93a0e6881f230165f1
0032921: require minimum CMAKE version 3.1 (for enabling CMAKE_CXX_STANDARD)

If we require CMAKE minimal version 3.1, rather than 2.8,
by default new policies are employed:
from CMP0024 to CMP0054.
Unique problematic policy is CMP0054:
`Only interpret if() arguments as variables or keywords when unquoted.`

Requiring of 3.1 as minimal version without preserving old behavior of 54th policy breaks MSVC compilation.
If we require cmake_policy (SET CMP0054 OLD), compilation finishs without errors.
New behavior of CMP0054 leads to changes in next target MSVC vcxproj files:
 - TKV3d
 - TKOpenGl
 - TKOpenGlTest
 - TKOpenGles
 - TKOpenGlesTest
Difference is absense of HAVE_OPENGL/HAVE_OPENGLES definitions.
So, source of error has been localizedin file occt_toolkit.cmake, in lines ~325 and ~327.
In accordance with old CMP0054 policy "CSF_OpenGlLibs" interprets as variable CSF_OpenGlLibs, rather than just a string.
Contrary, new policy interpret "CSF_OpenGlLibs" as a string.
To employ new policy, began since CMAKE 3.1 we should replace "CSF_OpenGlLibs" to "${CSF_OpenGlLibs}"
and "CSF_OpenGlesLibs" to "${CSF_OpenGlesLibs}".

P.S.

When cmake policy CMP0054 is set to NEW
expression
  "${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs"
is false,
while if policy CMP0054 is set to OLD
expression
  "${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs"
is true.
If replace "CSF_OpenGlLibs" to "${CSF_OpenGlLibs}"
expression is true independent on CMP0054 policy.
Notice, that OLD policy had beed taken place by default on master before
this ticket integration.
14 files changed:
CMakeLists.txt
adm/cmake/cotire.cmake
adm/cmake/occt_defs_flags.cmake
adm/cmake/occt_macros.cmake
adm/cmake/occt_toolkit.cmake
samples/glfw/CMakeLists.txt
samples/java/jniviewer/app/src/main/jni/CMakeLists.txt
samples/mfc/standard/01_Geometry/CMakeLists.txt
samples/mfc/standard/02_Modeling/CMakeLists.txt
samples/mfc/standard/03_ImportExport/CMakeLists.txt
samples/mfc/standard/04_HLR/CMakeLists.txt
samples/mfc/standard/mfcsample/CMakeLists.txt
samples/webgl/CMakeLists.txt
tools/CMakeLists.txt