Allow absolute paths for CMAKE_MODULE_PATH
This commit is contained in:
parent
99f222809f
commit
3b8761a18c
2 changed files with 17 additions and 11 deletions
|
@ -12,10 +12,4 @@ Usage
|
|||
```
|
||||
cmake -DCMAKE_MODULE_PATH:PATH=<cmake-d-dir>/cmake-d <path-to-source>
|
||||
```
|
||||
<br/>
|
||||
|
||||
---
|
||||
*Notes:*
|
||||
- *use absolute path for CMAKE_MODULE_PATH*
|
||||
- *Because internally cmake uses relative paths, on Windows, \<cmake-d-dir\> and cmake installation directory need to be on the same drive.*
|
||||
|
||||
|
|
|
@ -115,12 +115,24 @@ IF(NOT CMAKE_D_COMPILER_ID_RUN)
|
|||
FIND_FILE(CMAKE_PLATFORM_ID_CONTENT_FILE CMakePlatformId.di.in
|
||||
PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
|
||||
FILE(READ ${CMAKE_PLATFORM_ID_CONTENT_FILE} CMAKE_D_COMPILER_ID_PLATFORM_CONTENT)
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
# Workaround for bug http://public.kitware.com/Bug/view.php?id=14481
|
||||
FIND_FILE(CMAKE_D_COMPILER_ID_FILE_IN CMakeDCompilerId.d.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
|
||||
FILE(RELATIVE_PATH CMAKE_D_COMPILER_ID_FILE_IN_RELATIVE ${CMAKE_ROOT}/Modules ${CMAKE_D_COMPILER_ID_FILE_IN})
|
||||
STRING(REGEX REPLACE "[.]in$" "" CMAKE_COMPILER_ID_FILE_RELATIVE ${CMAKE_D_COMPILER_ID_FILE_IN_RELATIVE})
|
||||
CMAKE_DETERMINE_COMPILER_ID(D DFLAGS ${CMAKE_COMPILER_ID_FILE_RELATIVE})
|
||||
# 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)
|
||||
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)
|
||||
STRING(REPLACE "file(READ \${CMAKE_ROOT}/Modules/\${src}.in ID_CONTENT_IN)"
|
||||
"find_file(src_in \${src}.in PATHS \${CMAKE_ROOT}/Modules \${CMAKE_MODULE_PATH})
|
||||
file(READ \${src_in} ID_CONTENT_IN)
|
||||
unset(src_in CACHE)"
|
||||
CMAKE_DETERMINE_COMPILER_ID_CMAKE_CONTENT_PATCHED ${CMAKE_DETERMINE_COMPILER_ID_CMAKE_CONTENT})
|
||||
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)
|
||||
CMAKE_DETERMINE_COMPILER_ID(D DFLAGS CMakeDCompilerId.d)
|
||||
UNSET(CMAKE_D_COMPILER_ID_FILE_IN CACHE)
|
||||
UNSET(CMAKE_PLATFORM_ID_CONTENT_FILE CACHE)
|
||||
|
||||
|
|
Loading…
Reference in a new issue