-
Notifications
You must be signed in to change notification settings - Fork 594
Configuration - Parallel installing and improve catching cmake version #914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: IR
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -206,21 +206,23 @@ if (BUILD_FORCE_RelWithDebInfo) | |||||||||
| set (CMAKE_CONFIGURATION_TYPES Release Debug CACHE INTERNAL "" FORCE) | ||||||||||
| endif() | ||||||||||
|
|
||||||||||
| # option to enable or disable use of precompiled headers | ||||||||||
| if (NOT DEFINED BUILD_USE_PCH) | ||||||||||
| set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}") | ||||||||||
| endif() | ||||||||||
| # Version-gated build options (enabled by default when CMake version is sufficient) | ||||||||||
| OCCT_VERSION_GATED_OPTION (BUILD_USE_PCH "3.16" ON "${BUILD_USE_PCH_DESCR}") | ||||||||||
| OCCT_VERSION_GATED_OPTION (BUILD_INCLUDE_SYMLINK "3.14" ON "${BUILD_INCLUDE_SYMLINK_DESCR}") | ||||||||||
| OCCT_VERSION_GATED_OPTION (BUILD_INSTALL_PARALLEL "3.30" ON "${BUILD_INSTALL_PARALLEL_DESCR}") | ||||||||||
|
|
||||||||||
| if (CMAKE_VERSION VERSION_LESS "3.16") | ||||||||||
| OCCT_CHECK_AND_UNSET (BUILD_USE_PCH) | ||||||||||
| elseif (NOT BUILD_USE_PCH) | ||||||||||
| set (CMAKE_DISABLE_PRECOMPILE_HEADERS ON) | ||||||||||
| else () | ||||||||||
| # Apply precompiled headers setting | ||||||||||
| if (BUILD_USE_PCH) | ||||||||||
| set (CMAKE_DISABLE_PRECOMPILE_HEADERS OFF) | ||||||||||
| elseif (DEFINED BUILD_USE_PCH) | ||||||||||
| set (CMAKE_DISABLE_PRECOMPILE_HEADERS ON) | ||||||||||
| endif() | ||||||||||
|
|
||||||||||
| if (NOT DEFINED BUILD_INCLUDE_SYMLINK) | ||||||||||
| set (BUILD_INCLUDE_SYMLINK OFF CACHE BOOL "${BUILD_INCLUDE_SYMLINK_DESCR}") | ||||||||||
| # Apply parallel installation setting | ||||||||||
| if (BUILD_INSTALL_PARALLEL) | ||||||||||
| set_property (GLOBAL PROPERTY INSTALL_PARALLEL ON) | ||||||||||
| elseif (DEFINED BUILD_INSTALL_PARALLEL) | ||||||||||
| set_property (GLOBAL PROPERTY INSTALL_PARALLEL OFF) | ||||||||||
|
||||||||||
| set_property (GLOBAL PROPERTY INSTALL_PARALLEL OFF) | |
| set_property (GLOBAL PROPERTY INSTALL_PARALLEL OFF) | |
| else() | |
| set_property (GLOBAL PROPERTY INSTALL_PARALLEL OFF) |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,23 @@ macro (OCCT_CHECK_AND_UNSET VARNAME) | |||||||||||
| endif() | ||||||||||||
| endmacro() | ||||||||||||
|
|
||||||||||||
| # Macro to define a version-gated boolean option. | ||||||||||||
| # If CMake version is sufficient, option defaults to DEFAULT_ON value. | ||||||||||||
| # If CMake version is too old, option is unset and unavailable. | ||||||||||||
| # VARNAME - variable name | ||||||||||||
| # MIN_VERSION - minimum CMake version required | ||||||||||||
| # DEFAULT_ON - default value when version is sufficient (ON/OFF) | ||||||||||||
| # DESCRIPTION - variable description | ||||||||||||
| macro (OCCT_VERSION_GATED_OPTION VARNAME MIN_VERSION DEFAULT_ON DESCRIPTION) | ||||||||||||
| if (CMAKE_VERSION VERSION_LESS "${MIN_VERSION}") | ||||||||||||
| OCCT_CHECK_AND_UNSET (${VARNAME}) | ||||||||||||
| else() | ||||||||||||
| if (NOT DEFINED ${VARNAME}) | ||||||||||||
| set (${VARNAME} ${DEFAULT_ON} CACHE BOOL "${DESCRIPTION}") | ||||||||||||
|
||||||||||||
| set (${VARNAME} ${DEFAULT_ON} CACHE BOOL "${DESCRIPTION}") | |
| set (${VARNAME} ${DEFAULT_ON} CACHE BOOL "${DESCRIPTION}") | |
| else() | |
| # Update the cache entry's description and type, but keep the user's value | |
| set (${VARNAME} "${${VARNAME}}" CACHE BOOL "${DESCRIPTION}" FORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic has an edge case issue: when CMake version is < 3.16, BUILD_USE_PCH is unset, so DEFINED BUILD_USE_PCH is false, and neither branch executes. This means CMAKE_DISABLE_PRECOMPILE_HEADERS retains whatever value it had before. For clarity and correctness, consider adding an else clause to explicitly set CMAKE_DISABLE_PRECOMPILE_HEADERS ON when BUILD_USE_PCH is not defined, ensuring consistent behavior across all CMake versions.