函数定义 三:cmake_add_executable
2020-06-06 本文已影响0人
Feel君
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}
)