diff --git a/hipify-clang/CMakeLists.txt b/hipify-clang/CMakeLists.txt index 355b0cea7a..b9d009ad92 100644 --- a/hipify-clang/CMakeLists.txt +++ b/hipify-clang/CMakeLists.txt @@ -1,6 +1,15 @@ cmake_minimum_required(VERSION 2.8.8) project(hipify-clang) +set(BUILD_HIPIFY_CLANG 0 CACHE INTERNAL "") + +if (HIPIFY_CLANG_LLVM_DIR) + find_package(LLVM PATHS ${HIPIFY_CLANG_LLVM_DIR} REQUIRED) +else() + message(STATUS "hipify-clang will not be built. To build it please specify absolute path to LLVM 3.8 or higher using HIPIFY_CLANG_LLVM_DIR") + return() +endif() + option(HIPIFY_CLANG_TESTS "Build the tests for hipify-clang, if lit is installed" ON) # Disable the tests if `lit` is not installed. @@ -10,10 +19,6 @@ if (NOT LIT_COMMAND) message(STATUS "hipify-clang's tests are not being built because `lit` is not installed.") endif() -set(BUILD_HIPIFY_CLANG 0 CACHE INTERNAL "") - -find_package(LLVM PATHS ${HIPIFY_CLANG_LLVM_DIR} REQUIRED) - list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR}) include(AddLLVM) @@ -73,16 +78,14 @@ if (HIPIFY_CLANG_TESTS) # tests find_package(PythonInterp 2.7 REQUIRED EXACT) - set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - configure_file( - ${CMAKE_SOURCE_DIR}/tests/hipify-clang/lit.site.cfg.in + ${CMAKE_CURRENT_LIST_DIR}/../tests/hipify-clang/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg @ONLY ) add_lit_testsuite(test-hipify "Running HIPify regression tests" - ${CMAKE_SOURCE_DIR}/tests/hipify-clang + ${CMAKE_CURRENT_LIST_DIR}/../tests/hipify-clang PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg DEPENDS hipify-clang lit )