On 05/24/2012 12:22 PM, Justin Holewinski wrote:
> I narrowed the problem down to Clang not having
> Platform/Windows-Clang-{C,CXX}.cmake files.
There is an issue tracker entry for this:
http://www.cmake.org/Bug/view.php?id=13035
but it is in the backlog waiting for more feedback and a volunteer.
The main problem is distinguishing the GNU-compatible and MS-compatible
builds of Clang.
> If I add the following two files then everything starts to work as expected:
>
> Platform/Windows-Clang-C.cmake:
>
> if(MINGW)
> include(Platform/Windows-GNU)
> __windows_compiler_gnu(C)
> else()
> # Chain to generic Windows configuration
> include(Platform/Windows)
> endif()
>
> Platform/Windows-Clang-CXX.cmake:
>
> if(MINGW)
> include(Platform/Windows-GNU)
> __windows_compiler_gnu(C)
> else()
> # Chain to generic Windows configuration
> include(Platform/Windows)
> endif()
>
> This way, using Clang with MinGW will force GNU-style platform
> options instead of VS-style Windows options.
> Is this more or less the "right way" to fix this in CMake?
Interesting approach. That may be better than separating the
compiler id as mentioned in the above-linked issue. The "MINGW"
value is set based on CMAKE_C_PLATFORM_ID which is computed in
the same way and at the same time as CMAKE_C_COMPILER_ID. Try:
$ cat Platform/Windows-Clang-C.cmake
if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
include(Platform/Windows-GNU-C)
else()
include(Platform/Windows-cl)
endif()
$ cat Platform/Windows-Clang-CXX.cmake
if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
include(Platform/Windows-GNU-CXX)
else()
include(Platform/Windows-cl)
endif()
Do you have both the MS-style and GNU-style Clang available
to test?
Thanks,
-Brad
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake