美文网首页初见
函数定义 三:cmake_add_executable

函数定义 三:cmake_add_executable

作者: Feel君 | 来源:发表于2020-06-06 11:35 被阅读0次
    include (CMakeParseArguments)
    function(cmake_add_executable)
        message("ARGC = " ${ARGC})
        message("ARGV = " ${ARGV})
        message("ARG0 = " ${ARGV0})
    
        CMAKE_PARSE_ARGUMENTS(
            VK  "ISSET"
            "NAME;COMMAND;BASELINE"
            "SOURCES;LIBRARIES"
             ${ARGN}
        )
    
        set(CURRENT_APPNAME ${ARGV0})
    #    set(CURRENT_APPNAME ${VK_NAME})
    
        add_executable(${CURRENT_APPNAME} ${VK_SOURCES})
        target_link_libraries(${CURRENT_APPNAME} ${VK_LIBRARIES})
    
        install(TARGETS ${CURRENT_APPNAME}
            RUNTIME DESTINATION ${VK_INSTALL_DIR_BIN}/${APP_FOLDER}
            LIBRARY DESTINATION ${VK_INSTALL_DIR_LIB}
            ARCHIVE DESTINATION ${VK_INSTALL_DIR_LIB}
        )
    endfunction()
    
    set (CURRENT_SOURCE_FILES
        xml/test_scd1.cpp
        xml/scdapi.cpp
    )
    set (CURRENT_LINK_LIBRARIES
        ${VK_CORE_MODULE_LIBNAME}
        ${VK_SQL_MODULE_LIBNAME}
        )
    cmake_add_executable(test_scd1
        SOURCES ${CURRENT_SOURCE_FILES}
        LIBRARIES ${CURRENT_LINK_LIBRARIES}
        )
    

    相关文章

      网友评论

        本文标题:函数定义 三:cmake_add_executable

        本文链接:https://www.haomeiwen.com/subject/lftxtktx.html