1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-02 17:46:22 +03:00

0027344: Configuration, CMake: bugs with detecting third-party products

Information messages for TCL/TK search are corrected.

Compile definitions were added to OpenCASCADEConfig.cmake file
This commit is contained in:
ski 2016-04-05 12:38:53 +03:00 committed by bugmaster
parent 4b445d1848
commit a3d2cb2425
5 changed files with 50 additions and 5 deletions

View File

@ -804,6 +804,8 @@ endif()
set (OCCT_MODULES_ENABLED)
set (OCCT_LIBRARIES)
set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n")
set (OCCT_COMPILE_DEFINITIONS)
foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
if (TARGET ${OCCT_TOOLKIT})
@ -816,10 +818,33 @@ foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE")
list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE})
list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT})
# get compile definitions of target directory
get_directory_property (COMPILE_DEFINITIONS DIRECTORY "${${OCCT_TOOLKIT}_SOURCE_DIR}" "COMPILE_DEFINITIONS")
list (APPEND OCCT_COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS})
endif()
endif()
endforeach()
list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED)
list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS)
# export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files
foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
set (SET_OpenCASCADE_COMPILE_DEFINITIONS)
string (TOUPPER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_UPPER)
string (TOLOWER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_LOWER)
foreach(COMPILE_DEFINITION ${OCCT_COMPILE_DEFINITIONS})
string(REPLACE "(" "\\(" COMPILE_DEFINITION "${COMPILE_DEFINITION}")
string(REPLACE ")" "\\)" COMPILE_DEFINITION "${COMPILE_DEFINITION}")
set (SET_OpenCASCADE_COMPILE_DEFINITIONS "${SET_OpenCASCADE_COMPILE_DEFINITIONS}set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${OCCT_CONFIGURATION}>:${COMPILE_DEFINITION}>)\n")
endforeach()
set (SET_OpenCASCADE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
set (SET_OpenCASCADE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY)
endforeach()
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE})

View File

@ -55,7 +55,7 @@ endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
# use default (CMake) TCL search
find_package(TCL)
find_package(TCL QUIET)
# tcl include dir
if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
@ -291,4 +291,4 @@ if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
endif()
endif()

View File

@ -59,7 +59,7 @@ endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
# use default (CMake) TCL search
find_package(TCL)
find_package(TCL QUIET)
# tk include dir
if (NOT 3RDPARTY_TK_INCLUDE_DIR)
@ -283,4 +283,4 @@ if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TK)
endif()
endif()

View File

@ -0,0 +1,14 @@
#-----------------------------------------------------------------------------
#
# OpenCASCADECompileDefinitionsAndFlags-@OCCT_CONFIGURATION_LOWER@.cmake - OpenCASCADE CMake file
# with compile definitions and C/C++ flags for @OCCT_CONFIGURATION@ configuration.
#
# This file is configured by OpenCASCADE.
#
# The C and C++ flags added by OpenCASCADE to the cmake-configured flags.
set (OpenCASCADE_C_FLAGS_@OCCT_CONFIGURATION_UPPER@ "@SET_OpenCASCADE_CMAKE_C_FLAGS@")
set (OpenCASCADE_CXX_FLAGS_@OCCT_CONFIGURATION_UPPER@ "@SET_OpenCASCADE_CMAKE_CXX_FLAGS@")
# The compile definitions used by OpenCASCADE.
@SET_OpenCASCADE_COMPILE_DEFINITIONS@

View File

@ -54,7 +54,7 @@ set (OpenCASCADE_BUILD_WITH_DEBUG @BUILD_WITH_DEBUG@)
set (OpenCASCADE_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
@SET_OpenCASCADE_BUILD_TYPE@
# Use of third-party libraries
# Use of third-party libraries.
set (OpenCASCADE_WITH_TCL @USE_TCL@)
set (OpenCASCADE_WITH_FREETYPE @USE_FREETYPE@)
set (OpenCASCADE_WITH_FREEIMAGE @USE_FREEIMAGE@)
@ -64,6 +64,12 @@ set (OpenCASCADE_WITH_VTK @USE_VTK@)
@SET_OpenCASCADE_WITH_D3D@
@SET_OpenCASCADE_WITH_GLX@
# Import OpenCASCADE compile definitions, C and C++ flags for each installed configuration.
file(GLOB CONFIG_FILES "${CMAKE_CURRENT_LIST_DIR}/OpenCASCADECompileDefinitionsAndFlags-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
if (NOT OpenCASCADE_FIND_COMPONENTS)
set (OpenCASCADE_FIND_COMPONENTS ${OpenCASCADE_MODULES})
endif ()