diff --git a/cmake-d/CMakeDetermineDCompiler.cmake b/cmake-d/CMakeDetermineDCompiler.cmake index e9712c4..b677489 100644 --- a/cmake-d/CMakeDetermineDCompiler.cmake +++ b/cmake-d/CMakeDetermineDCompiler.cmake @@ -120,7 +120,7 @@ if(NOT CMAKE_D_COMPILER_ID_RUN) # Workaround for bug http://public.kitware.com/Bug/view.php?id=14481 # if CMAKE_MODULE_PATH is used, then patch ${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake get_filename_component(CMAKE_D_COMPILER_ID_FILE_IN_PATH ${CMAKE_D_COMPILER_ID_FILE_IN} PATH) - if(CMAKE_D_COMPILER_ID_FILE_IN_PATH STREQUAL ${CMAKE_ROOT}/Modules) + if(CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_D_COMPILER_ID_FILE_IN_PATH STREQUAL ${CMAKE_ROOT}/Modules) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) else(CMAKE_D_COMPILER_ID_FILE_IN_PATH STREQUAL ${CMAKE_ROOT}/Modules) file(READ ${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake CMAKE_DETERMINE_COMPILER_ID_CMAKE_CONTENT) @@ -132,7 +132,7 @@ if(NOT CMAKE_D_COMPILER_ID_RUN) file(WRITE ${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerId.cmake ${CMAKE_DETERMINE_COMPILER_ID_CMAKE_CONTENT_PATCHED}) include(${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerId.cmake) - endif(CMAKE_D_COMPILER_ID_FILE_IN_PATH STREQUAL ${CMAKE_ROOT}/Modules) + endif(CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_D_COMPILER_ID_FILE_IN_PATH STREQUAL ${CMAKE_ROOT}/Modules) CMAKE_DETERMINE_COMPILER_ID(D DFLAGS CMakeDCompilerId.d) unset(CMAKE_D_COMPILER_ID_FILE_IN CACHE) unset(CMAKE_PLATFORM_ID_CONTENT_FILE CACHE)