[CMake] Adding "*.obj" geometry files...

Petr Kmoch petr.kmoch at gmail.com
Wed Jun 13 08:36:06 EDT 2012


You could use solution filters to put all the copy targets into one folder:

set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
set_property(TARGET ${RESOURCESCOPYTARGET} PROPERTY FOLDER "Copy
Projects") #for each resource copy target

Petr

On Wed, Jun 13, 2012 at 2:26 PM, Daniel Dekkers <d.dekkers at cthrough.nl> wrote:
> Hi Tim,
>
> That works. In our case we get:
>
> # Additional dedicated "copy-the-resource-files-for-this-app"-target
> strategy.
> # Copies resource files to the build directory, triggered by a file change
> in one of them.
> IF( RT_ALL_RSRC_FILES )
>        SET( RESOURCESCOPYTARGET "Copy${RT_APP_NAME}Resources" )
>        FOREACH( RSRC_FILE ${RT_ALL_RSRC_FILES} )
>                GET_FILENAME_COMPONENT(RSRC_FILE_NO_PATH ${RSRC_FILE} NAME)
>                ADD_CUSTOM_COMMAND(
>                        OUTPUT
> "${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${RSRC_FILE_NO_PATH}"
>                        COMMAND ${CMAKE_COMMAND} -E copy_if_different
> ${RSRC_FILE} ${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${RSRC_FILE_NO_PATH}
>                        DEPENDS "${RSRC_FILE}"
>                        )
>                LIST( APPEND DEPENDENT_RSRC_FILES
> "${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${RSRC_FILE_NO_PATH}" )
>        ENDFOREACH()
>        ADD_CUSTOM_TARGET( ${RESOURCESCOPYTARGET} ALL DEPENDS
> ${DEPENDENT_RSRC_FILES} )
>        ADD_DEPENDENCIES(${RT_APP_NAME} ${RESOURCESCOPYTARGET})
> ENDIF()
>
> Only "problem" are the extra targets shown in the IDE. A bit "cluttery".
> We have anywhere between 1 or 10 executables in a single solution and they
> all get their own additional CopyResources target.
> But, ok...
>
> Thanks!
> Daniel
>
>
>
> -----Oorspronkelijk bericht-----
> Van: Tim Hutton [mailto:tim.hutton at gmail.com]
> Verzonden: woensdag 13 juni 2012 12:42
> Aan: Daniel Dekkers
> CC: Petr Kmoch; cmake at cmake.org; Bill Hoffman
> Onderwerp: Re: [CMake] Adding "*.obj" geometry files...
>
> You can group all the files to be copied into a single subproject.
>
> We do this here:
> http://reaction-diffusion.googlecode.com/svn/trunk/Ready/CMakeLists.txt
> (see the section "copy installation files to build folder")
>
> On 13 June 2012 11:13, Daniel Dekkers <d.dekkers at cthrough.nl> wrote:
>> Somewhat related...
>>
>> We now have the resources excluded from the build but visible in the
>> IDE. So far so good.
>> But we also want to copy them (all) to the build directory.
>> We have a post build command that does that.
>> But if you only change the contents of one of the resource files, a
>> rebuild is not invoked (exclude from build) and so the files are not
> copied.
>> For another project we made specific targets (ADD_CUSTOM_TARGET) just
>> to handle the copying but that gives a lot of extra subprojects in the
> IDE.
>> Is there another way to achieve this?
>>
>> Thanks,
>> Daniel
>>
>> -----Oorspronkelijk bericht-----
>> Van: Petr Kmoch [mailto:petr.kmoch at gmail.com]
>> Verzonden: woensdag 13 juni 2012 8:10
>> Aan: Daniel Dekkers
>> CC: Bill Hoffman; cmake at cmake.org
>> Onderwerp: Re: [CMake] Adding "*.obj" geometry files...
>>
>> Hi Daniel.
>>
>> Yes, that's how Visual Studio shows excluded files. If you exclude a
>> file by setting its "Excluded from build" property manually, you get the
> same.
>>
>> Petr
>>
>> On Tue, Jun 12, 2012 at 8:31 PM, Daniel Dekkers
>> <d.dekkers at cthrough.nl>
>> wrote:
>>> Ok, great, works.
>>> So I guess the little red stop-sign icons shown by Visual Studio
>>> denote that these files are excluded from the build?
>>>
>>> Thanks,
>>> Daniel
>>>
>>>
>>> -----Oorspronkelijk bericht-----
>>> Van: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] Namens
>>> Bill Hoffman
>>> Verzonden: dinsdag 12 juni 2012 19:41
>>> Aan: cmake at cmake.org
>>> Onderwerp: Re: [CMake] Adding "*.obj" geometry files...
>>>
>>> On 6/12/2012 1:10 PM, Daniel Dekkers wrote:
>>>> Hi,
>>>>
>>>> We are adding some resource files (XML files, shaders, etc.) to a
>>>> Visual Studio project just to make them visible and accessible in
>>>> the
>> IDE.
>>>>
>>>> We also add geometry files with the extension "obj". Visual Studio
>>>> treats these as regular object files and starts using them during
>>>> the
>>> build.
>>>>
>>>> Is there a way that we can "label" these obj files so Visual Studio
>>>> leaves them alone?
>>>>
>>>> Kind Regards,
>>>>
>>>> Daniel Dekkers
>>>>
>>> Mark them as HEADER_FILE_ONLY .
>>>
>>>
>>> http://www.cmake.org/cmake/help/v2.8.8/cmake.html#prop_sf:HEADER_FILE
>>> _
>>> ONLY
>>>
>>> --
>>>
>>> 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
>>>
>>> --
>>>
>>> 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
>>
>> --
>>
>> 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
>
>
>
> --
> Tim Hutton - http://www.sq3.org.uk - http://profiles.google.com/tim.hutton/
>
> --
>
> 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