DiscussionsIssue archiveOCCT:Configuration

Archived issue #0027355

Configuration, CMake: install path on Windows is incorrectly processed

Open CASCADEOCCT:Configurationclosed9 public notes

Search issues

Description

With CMake, the standard way to specify installation directory is to use CMAKE_INSTALL_PREFIX variable:

cmake -DCMAKE_INSTALL_PREFIX=/path/to/the/install/dir ...

On Linux, this variable defaults to "/usr/local", while on Windows, it defaults to "C:/Program Files" (https://cmake.org/cmake/help/v2.8.11/cmake.html#variable:CMAKE_INSTALL_PREFIX).

All dependent installation directories (for includes, libs, executables, resources, docs, adm files etc) are inherited from CMAKE_INSTALL_PREFIX.

But 1: On Windows, OCCT hardcodes CMAKE_INSTALL_PREFIX to https://cmake.org/cmake/help/v2.8.11/cmake.html#variable:CMAKE_INSTALL_PREFIX:

if (NOT DEFINED INSTALL_DIR)
  # set default install directory for Windows
  if (WIN32)
    set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}")
  endif()
  set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}")
endif()

This does not allow specifying CMAKE_INSTALL_PREFIX via the command line as its value is ignored. This is incorrect and should be changed.

  if (WIN32 and not CMAKE_INSTALL_PREFIX)
    set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}")
  endif()

Bug 2. On Windows, if INSTALL_DIR is specified in native Windows style - with back slashes, the configuration fails. This should be fixed - it seems that TO_CMAKE_PATH function should be used when processing this variable.
Also, as soon as Bug 1 is fixed, it will be necessary to check if Bug 2 is not reproduced with CMAKE_INSTALL_PREFIX (note: with standard way, without any customization, CMAKE_INSTALL_PREFIX is correctly processed by CMake).

Steps to reproduce

Run CMake with -DINSTALL_DIR:STRING=D:\occt and with -DCMAKE_INSTALL_PREFIX:STRING=D:\occt and check the INSTALL_DIR value in cache. It should be defined as specified but with straight slashes.

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: ibs
Date: Tue Apr 5 13:23:33 2016 +0300

    0027355: Configuration, CMake: install path on Windows is incorrectly processed
    
    a default value of CMAKE_INSTALL_PREFIX is set only when this variable is not specified by an user
02Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: abv
Date: Tue Apr 5 13:34:28 2016 +0300

    0027355: Configuration, CMake: install path on Windows is incorrectly processed
    
    Avoid resetting CMAKE_INSTALL_PREFIX if defined.
    Back slashes are converted to straight slashes in INSTALL_DIR and 3RDPARTY_DIR variables.
03Commenter 3
The fix is pushed to CR27355_1, please review
04Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
05Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
06Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
07Commenter 7
Please test.
08Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]
09Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records