comparison cmake/function/MalikaniaDefineExecutable.cmake @ 183:387f6b0a5420

CMake: remove vera until we get clang-tidy, #903
author David Demelier <markand@malikania.fr>
date Fri, 19 Oct 2018 20:27:02 +0200
parents 3107ce017c3a
children 0a285d62ace7
comparison
equal deleted inserted replaced
182:3107ce017c3a 183:387f6b0a5420
19 # 19 #
20 # malikania_define_executable 20 # malikania_define_executable
21 # --------------------------- 21 # ---------------------------
22 # 22 #
23 # malikania_define_executable( 23 # malikania_define_executable(
24 # TARGET The target name 24 # TARGET The target name
25 # SOURCES The list of sources 25 # SOURCES The list of sources
26 # FLAGS (Optional) List of flags 26 # FLAGS (Optional) List of flags
27 # INCLUDES (Optional) List of include directories 27 # INCLUDES (Optional) List of include directories
28 # LIBRARIES (Optional) List of libraries 28 # LIBRARIES (Optional) List of libraries
29 # ) 29 # )
30 # 30 #
31 # Create an executable. Be sure to quote SOURCES, if not only the first file will be passed. 31 # Create an executable. Be sure to quote SOURCES, if not only the first file will be passed.
32 # If you need flags, just pass them without -D or /D, this is automatically done for you. 32 # If you need flags, just pass them without -D or /D, this is automatically done for you.
33 # 33 #
34 34
35 include(CMakeParseArguments) 35 include(CMakeParseArguments)
36 36
37 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaBuildAssets.cmake) 37 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaBuildAssets.cmake)
38 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaVeraCheck.cmake)
39 38
40 function(malikania_define_executable) 39 function(malikania_define_executable)
41 set(singleArgs TARGET) 40 set(singleArgs TARGET)
42 set(multiArgs ASSETS SOURCES FLAGS INCLUDES LIBRARIES) 41 set(multiArgs ASSETS SOURCES FLAGS INCLUDES LIBRARIES)
43 42
44 cmake_parse_arguments(EXE "" "${singleArgs}" "${multiArgs}" ${ARGN}) 43 cmake_parse_arguments(EXE "" "${singleArgs}" "${multiArgs}" ${ARGN})
45 44
46 if (NOT EXE_TARGET) 45 if (NOT EXE_TARGET)
47 message(FATAL_ERROR "Missing TARGET parameter") 46 message(FATAL_ERROR "Missing TARGET parameter")
48 endif () 47 endif ()
49 if (NOT EXE_SOURCES) 48 if (NOT EXE_SOURCES)
50 message(FATAL_ERROR "Missing SOURCES parameter") 49 message(FATAL_ERROR "Missing SOURCES parameter")
51 endif () 50 endif ()
52 51
53 malikania_build_assets("${EXE_ASSETS}" assets) 52 malikania_build_assets("${EXE_ASSETS}" assets)
54 53
55 add_executable(${EXE_TARGET} ${EXE_SOURCES} ${EXE_ASSETS} ${assets}) 54 add_executable(${EXE_TARGET} ${EXE_SOURCES} ${EXE_ASSETS} ${assets})
56 target_link_libraries(${EXE_TARGET} ${EXE_LIBRARIES}) 55 target_link_libraries(${EXE_TARGET} ${EXE_LIBRARIES})
57 target_include_directories( 56 target_include_directories(
58 ${EXE_TARGET} 57 ${EXE_TARGET}
59 PRIVATE 58 PRIVATE
60 ${CMAKE_CURRENT_BINARY_DIR}/assets 59 ${CMAKE_CURRENT_BINARY_DIR}/assets
61 ${EXE_INCLUDES} 60 ${EXE_INCLUDES}
62 ) 61 )
63 target_compile_definitions(${EXE_TARGET} PRIVATE ${EXE_FLAGS}) 62 target_compile_definitions(${EXE_TARGET} PRIVATE ${EXE_FLAGS})
64 set_target_properties( 63 set_target_properties(
65 ${EXE_TARGET} 64 ${EXE_TARGET}
66 PROPERTIES 65 PROPERTIES
67 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin 66 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
68 ) 67 )
69 foreach (c ${CMAKE_CONFIGURATION_TYPES}) 68 foreach (c ${CMAKE_CONFIGURATION_TYPES})
70 string(TOUPPER ${c} cu) 69 string(TOUPPER ${c} cu)
71 set_target_properties( 70 set_target_properties(
72 ${EXE_TARGET} 71 ${EXE_TARGET}
73 PROPERTIES 72 PROPERTIES
74 RUNTIME_OUTPUT_DIRECTORY_${cu} ${CMAKE_BINARY_DIR}/bin/${c} 73 RUNTIME_OUTPUT_DIRECTORY_${cu} ${CMAKE_BINARY_DIR}/bin/${c}
75 ) 74 )
76 endforeach() 75 endforeach()
77
78 malikania_vera_check(${EXE_TARGET} "${EXE_SOURCES}")
79 endfunction() 76 endfunction()