[CMake] Platform tests counts as errors.

David Cole david.cole at kitware.com
Tue Mar 22 12:07:11 EDT 2011


Have you considered using the ExternalProject module for custom
commands like this?

It already takes care of some tricky things like this.

In CMake 2.8.4, you'll see occurrences of this in ExternalProject.cmake:
set(ENV{VS_UNICODE_OUTPUT} \"\")
(which gets generated inside of scripts run at build time... you
cannot simply add something like this to your CMakeLists...)

That effectively tells Visual Studio not to display that sort of
compiler output from sub-processes. It's a completely non-obvious
solution that might take days or weeks of research to re-discover on
your own. And it's already accounted for in the custom commands
generated when using ExternalProject.

Give it a whirl.

Something like this, in your case:

include(ExternalProject)
ExternalProject_Add(CxNativeTg
  SOURCE_DIR "${FOO_SOURCE_DIR}"
  CMAKE_ARGS
    -DCMAKE_BUILD_TYPE=Release
)

(That will configure and build as an external project using all custom
commands. If you don't also want the build step, you can use
BUILD_COMMAND "" to avoid it...)


HTH,
David


On Mon, Mar 21, 2011 at 10:17 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:
> Consider this custom_command:
>
>  add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
>    COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${FOO_SOURCE_DIR}
>    WORKING_DIRECTORY ${CX_NATIVE_TG_DIR})
>
> When it is executed from a Makefile-based generator, no
> problem. However, when it is executed from the VS 2008 IDE, failed
> platform tests are signaled as errors:
>
> 2>-- Looking for sys/dir.h
> 2>CheckIncludeFile.c
> 2>CheckIncludeFile.c(1) : fatal error C1083: Cannot open include file: 'sys/dir.h': No such file or directory
> 2>-- Looking for sys/dir.h - not found
>
> At the end, the custom_command is signaled as failed by the IDE because
> of those "errors".
>
> First of all, why
>
> 2>CheckIncludeFile.c
> 2>CheckIncludeFile.c(1) : fatal error C1083: Cannot open include file: 'sys/dir.h': No such file or directory
>
> is shown in the middle of the usual
>
> 2>-- Looking for sys/dir.h
> 2>-- Looking for sys/dir.h - not found
>
> ?
>
> Second, what can I do so the IDE does not interpret failed platform
> tests as errors?
>
> _______________________________________________
> 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
>


More information about the CMake mailing list