Hi all,

I have problems with the following cmake build script:

find_program(CCP_EXECUTABLE cpp REQUIRED HINTS /opt/local/bin)
find_program(ASN1C_EXECUTABLE asn1c REQUIRED HINTS /opt/local/bin)

if(ASN1C_EXECUTABLE AND CCP_EXECUTABLE)
   set(ASN1C_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")

    ### collect the list of generated source
    ###TBD### aux_source_directory(${ASN1C_OUTPUT_DIR} ASN1_SOURCES)
    ### message(„${ASN1_SOURCES}“)
    set(ASN1_SOURCES converter-sample.c pdu_collection.c)


    ### Add a target with no output so it will always be built.
    add_custom_target(regen
        COMMAND ${CCP_EXECUTABLE} -undef -P
            -include ${CMAKE_CURRENT_SOURCE_DIR}/CertificateProfile.asn1
            ${CMAKE_CURRENT_SOURCE_DIR}/EncryptedBsc.asn1 >
            _sample.asn1
        WORKING_DIRECTORY ${ASN1C_OUTPUT_DIR}
        VERBATIM)


    ### adding a custom command to produce an output.
    add_custom_target(OUTPUT ${ASN1_SOURCES}
        COMMAND ${ASN1C_EXECUTABLE} -S 
${CMAKE_CURRENT_SOURCE_DIR}/../../skeletons
            -pdu=all ${ASN1C_OUTPUT_DIR}/_sample.asn1
        COMMAND astyle *.c *.h
        DEPENDS ${ASN1C_OUTPUT_DIR}/_sample.asn1
        WORKING_DIRECTORY ${ASN1C_OUTPUT_DIR}
        VERBATIM)

    set_property(DIRECTORY APPEND PROPERTY
                ADDITIONAL_MAKE_CLEAN_FILES ${ASN1C_OUTPUT_DIR}/_sample.asn1 
${ASN1_SOURCES})

    
    # Tell CMake to build a library from this source files
    add_library(sample-asn1 ${ASN1_SOURCES})

    message ("asn1c found, use target regen to generate code again")
endif()

My intention is to create a dependency tree from the library to the asn1 file.
The source file list should be dynamic because it will be changed when the asn1 
specification is changed.

The OUTPUT parameter is generated to illegal shell syntax.

I would expect that the library is rebuild after build target ‚regen'.
This is not the case, so I manually start the build the target ‚OUTPUT’.

But than I get the following error while build:

Claus-MacBook-Pro:build clausklein$ ninja OUTPUT
[1/1] cd 
/Users/clausklein/Workspace/c/asn1c/examples/Certificate/buil.../c/asn1c/examples/Certificate/build/_sample.asn1
 && astyle "*.c" "*.h
FAILED: cd /Users/clausklein/Workspace/c/asn1c/examples/Certificate/build && 
converter-sample.c pdu_collection.c && /opt/local/bin/asn1c -S 
/Users/clausklein/Workspace/c/asn1c/examples/Certificate/../../skeletons 
-pdu=all 
/Users/clausklein/Workspace/c/asn1c/examples/Certificate/build/_sample.asn1 && 
astyle "*.c" "*.h"
/bin/sh: converter-sample.c: command not found
ninja: build stopped: subcommand failed.
Claus-MacBook-Pro:build clausklein$ 


too find the target name „OUTPUT“ strange:

Claus-MacBook-Pro:build clausklein$ ninja help
[1/1] All primary targets available:
OUTPUT: phony
edit_cache: phony
install: phony
install/local: phony
install/strip: phony
list_install_components: phony
rebuild_cache: phony
regen: phony
converter-sample: phony
libsample-asn1.a: phony
sample: phony
sample-asn1: phony
build.ninja: RERUN_CMAKE
clean: CLEAN
help: HELP
Claus-MacBook-Pro:build clausklein$ 

/usr/bin/cmake --version
cmake version 3.0.0-rc3


Any help would be welcome

Claus

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to