Allow cmake UI to switch between static and dynamic.

Dependency changes between static and dynamic build caused a cmake
crash when using ccmake or cmake-gui.  This is fixed by cmake in
version 3.12.  Until then deleting the target dependency data at
project startup allows the UI to function correctly.

Also warns about cosmetic issues when using older cmakes.

Change-Id: I8bd2ade9b59e7c27652090d1b6298cb01095a965
This commit is contained in:
Sean Keely
2020-06-17 15:08:28 -05:00
orang tua 8fd41bd513
melakukan 0dae86f686
2 mengubah file dengan 20 tambahan dan 2 penghapusan
+17
Melihat File
@@ -42,6 +42,23 @@
cmake_minimum_required ( VERSION 3.5.0 )
## Cosmetic Cmake version warnings.
if(NOT EXISTS VERSION_WARNED)
set (VERSION_WARNED FALSE CACHE BOOL "")
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.6.0" AND NOT ${VERSION_WARNED})
message("Your CMake version is too old for full functionality.
Generated package file names may be incorrect.
Please update to CMake 3.6 or newer to generate correct package file names")
set( VERSION_WARNED TRUE CACHE BOOL "Suppress cosmetic build errors due to CMake version after first warning." FORCE )
mark_as_advanced( FORCE VERSION_WARNED )
endif()
## Clear target dependency data.
## Needed to allow UI transitions between static and dynamic builds.
## Need an update to CMake 3.12 to remove this hack. See CMake policy change CMP0073.
unset ( hsa-runtime64_LIB_DEPENDS CACHE )
## Set core runtime module name and project name.
set ( CORE_RUNTIME_NAME "hsa-runtime64" )
set ( CORE_RUNTIME_TARGET "${CORE_RUNTIME_NAME}" )
@@ -46,12 +46,13 @@ cmake_minimum_required ( VERSION 3.5.0 )
set (QUIT 0)
# Import target 'clang'
find_package(Clang REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/llvm PATHS /opt/rocm/llvm )
find_package(Clang REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/llvm ${CMAKE_PREFIX_PATH}/llvm PATHS /opt/rocm/llvm )
# Device libs doesn't support find_package yet.
get_include_path(BITCODE_DIR "Bitcode library path" RESULT FOUND NAMES "opencl.amdgcn.bc"
HINTS "${CMAKE_INSTALL_PREFIX}/lib/bitcode" "${CMAKE_INSTALL_PREFIX}/lib/x86_64/bitcode"
PATHS "/opt/rocm/lib/bitcode" "${CMAKE_INSTALL_PREFIX}/lib/x86_64/bitcode")
"${CMAKE_PREFIX_PATH}/lib/bitcode" "${CMAKE_PREFIX_PATH}/lib/x86_64/bitcode"
PATHS "/opt/rocm/lib/bitcode" "/opt/rocm/lib/x86_64/bitcode")
if (NOT ${FOUND})
set (QUIT 1)
endif()