View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014447CMakeCMakepublic2013-09-28 14:412016-06-10 14:31
ReporterVeniamin Gvozdikov 
Assigned ToKitware Robot 
PriorityhighSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0014447: Support $<TARGET_OBJECT:obj> as DEPENDS in add_custom_command
DescriptionHello,

I had a strange trouble with add DEPENDS in add_custom_command by $<TARGET_OBJECTS:obj> and I hacked that with set(cjson_obj_2 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cjson_objs.dir/lua_cjson.c.o) in real path to object. This is bad way for depends, please add support in new version.

set(cjson_obj)
 
add_library(cjson_objs OBJECT lua_cjson.c strbuf.c ${FPCONV_SOURCES})
set_target_properties(cjson_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(cjson_obj ${cjson_obj} $<TARGET_OBJECTS:cjson_objs>)
 
if(ENABLE_DTRACE AND DTRACE)
    message(STATUS "DTrace found and enabled")
    add_definitions(-DENABLE_DTRACE)
    set(D_FILE ${PROJECT_SOURCE_DIR}/cjson_dtrace)
    execute_process(
       COMMAND ${DTRACE} -h -s ${D_FILE}.d -o ${D_FILE}.h
    )
    if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
        set(cjson_obj_2 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cjson_objs.dir/lua_cjson.c.o)
        set(dtrace_obj ${CMAKE_CURRENT_BINARY_DIR}/dtrace.o)
        add_custom_command(OUTPUT ${dtrace_obj}
            COMMAND ${DTRACE} -G -s ${D_FILE}.d -o ${dtrace_obj} ${cjson_obj_2}
            DEPENDS ${cjson_obj_2}
        )
        set_source_files_properties(${dtrace_obj}
            PROPERTIES
            EXTERNAL_OBJECT true
            GENERATED true
        )
        set(cjson_obj ${cjson_obj} ${dtrace_obj})
        unset(cjson_obj_2)
        unset(dtrace_obj)
        unset(D_FILE)
    endif()
endif()
 
add_library(cjson MODULE ${cjson_obj})
set_target_properties(cjson PROPERTIES PREFIX "")
target_link_libraries(cjson ${_MODULE_LINK})
Steps To ReproduceTry my example of cmake code.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0042379)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-09-28 14:41 Veniamin Gvozdikov New Issue
2016-06-10 14:29 Kitware Robot Note Added: 0042379
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team