[CMake] Ninja: It's ninja issue, or CMake problem?

Loaden loaden at gmail.com
Tue Sep 25 04:10:01 EDT 2012


Sorry, It's wrong. Here is the correct function:
function(use_msvc_precompiled_header target sources)

    if(NOT ${target}_PCH_BINARY_FILE)

        message(FATAL_ERROR "[${target}] Precompiled binary does not exist")

        return()

    endif()

    get_target_property(targetSources ${target} SOURCES)

    list(FIND targetSources ${${${target}_PCH_SOURCE_VAR}} result)

    if(result EQUAL -1)

        message(FATAL_ERROR "[${target}] Please add
'\${${${target}_PCH_SOURCE_VAR}}' or '${${${target}_PCH_SOURCE_VAR}}'
to target")

        return()

    endif()

    set(pchBinaryFile ${${target}_PCH_BINARY_FILE})

*    foreach(src ${sources})*

*        set_source_files_properties(${src} PROPERTIES*

*            COMPILE_FLAGS "/Yu\"${pchBinaryFile}\"
/FI\"${pchBinaryFile}\" /Fp\"${pchBinaryFile}\""*

*            OBJECT_DEPENDS ${pchBinaryFile}*

*        )*

*    endforeach()*

endfunction()



2012/9/25 Loaden <loaden at gmail.com>

> I don't think so.
> See:
> function(add_msvc_precompiled_header target)
>
>     set(pchBinaryFile ${CMAKE_CURRENT_BINARY_DIR}/${target}_pch.pch)
>
> *    set_source_files_properties(${${${target}_PCH_SOURCE_VAR}} PROPERTIES*
>
> *        COMPILE_FLAGS "/Yc\"${${target}_PCH_HEADER_FILE}\" /Fp\"${pchBinaryFile}\""*
>
> *        OBJECT_OUTPUTS ${pchBinaryFile}*
>
> *    )*
>
>     message(STATUS "[${target}] Precompiled binary is \"${pchBinaryFile}\"")
>
>     set(${target}_PCH_BINARY_FILE ${pchBinaryFile}
>
>         CACHE INTERNAL "Precompiled binary file"
>
>     )
>
> endfunction()
>
>
>
> 2012/9/25 Peter Kümmel <syntheticpp at gmx.net>
>
>> Maybe by "accident". Which cmake command do you use to add the dependency?
>
>
>
>
> --
> *Please don't ask where I come from, It's a shame!*
> Best Regards
> Yuchen
>
>


-- 
*Please don't ask where I come from, It's a shame!*
Best Regards
Yuchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120925/235aecbf/attachment.htm>


More information about the CMake mailing list