summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/common
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2017-08-15 17:40:26 +0200
committermanuel <manuel@mausz.at>2017-08-15 17:40:26 +0200
commit86b22151f0758311fd146ff508e7254337414bc1 (patch)
treefdd6ca46ba57b7f063740541c034ce60c7cdd0c5 /cmake/scripts/common
parent4c3251ec645c8b71820dab7e51e612e5919d4e75 (diff)
downloadkodi-pvr-build-86b22151f0758311fd146ff508e7254337414bc1.tar.gz
kodi-pvr-build-86b22151f0758311fd146ff508e7254337414bc1.tar.bz2
kodi-pvr-build-86b22151f0758311fd146ff508e7254337414bc1.zip
sync with upstream
Diffstat (limited to 'cmake/scripts/common')
-rw-r--r--cmake/scripts/common/Macros.cmake4
-rw-r--r--cmake/scripts/common/ProjectMacros.cmake33
2 files changed, 37 insertions, 0 deletions
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake
index 8bee3da..09c9c36 100644
--- a/cmake/scripts/common/Macros.cmake
+++ b/cmake/scripts/common/Macros.cmake
@@ -89,6 +89,10 @@ function(core_add_library name)
89 target_sources(lib${APP_NAME_LC} PRIVATE ${FILES}) 89 target_sources(lib${APP_NAME_LC} PRIVATE ${FILES})
90 set(CORE_LIBRARY lib${APP_NAME_LC} PARENT_SCOPE) 90 set(CORE_LIBRARY lib${APP_NAME_LC} PARENT_SCOPE)
91 endif() 91 endif()
92 foreach(src ${SOURCES})
93 list(APPEND sca_sources ${CMAKE_CURRENT_SOURCE_DIR}/${src})
94 endforeach()
95 set(sca_sources ${sca_sources} CACHE STRING "" FORCE)
92endfunction() 96endfunction()
93 97
94# Add a test library, and add sources to list for gtest integration macros 98# Add a test library, and add sources to list for gtest integration macros
diff --git a/cmake/scripts/common/ProjectMacros.cmake b/cmake/scripts/common/ProjectMacros.cmake
index 89ecca4..641e047 100644
--- a/cmake/scripts/common/ProjectMacros.cmake
+++ b/cmake/scripts/common/ProjectMacros.cmake
@@ -75,6 +75,39 @@ function(GTEST_ADD_TESTS executable extra_args)
75 endforeach() 75 endforeach()
76endfunction() 76endfunction()
77 77
78function(sca_add_tests)
79 find_program(CLANGCHECK_COMMAND clang-check)
80 find_program(CPPCHECK_COMMAND cppcheck)
81 if(CLANGCHECK_COMMAND AND CMAKE_EXPORT_COMPILE_COMMANDS)
82 configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/linux/clang-check-test.sh.in
83 ${CORE_BUILD_DIR}/clang-check-test.sh)
84 endif()
85 if(CPPCHECK_COMMAND)
86 configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/linux/cppcheck-test.sh.in
87 ${CORE_BUILD_DIR}/cppcheck-test.sh)
88 set(CPPCHECK_INCLUDES)
89 foreach(inc ${INCLUDES})
90 list(APPEND CPPCHECK_INCLUDES -I ${inc})
91 endforeach()
92 endif()
93 foreach(src ${sca_sources})
94 file(RELATIVE_PATH name ${PROJECT_SOURCE_DIR} ${src})
95 get_filename_component(EXT ${src} EXT)
96 if(EXT STREQUAL .cpp)
97 if(CLANGCHECK_COMMAND AND CMAKE_EXPORT_COMPILE_COMMANDS)
98 add_test(NAME clang-check+${name}
99 COMMAND ${CORE_BUILD_DIR}/clang-check-test.sh ${CLANGCHECK_COMMAND} ${src}
100 CONFIGURATIONS analyze clang-check)
101 endif()
102 if(CPPCHECK_COMMAND)
103 add_test(NAME cppcheck+${name}
104 COMMAND ${CORE_BUILD_DIR}/cppcheck-test.sh ${CPPCHECK_COMMAND} ${src} ${CPPCHECK_INCLUDES}
105 CONFIGURATIONS analyze cppcheck)
106 endif()
107 endif()
108 endforeach()
109endfunction()
110
78function(whole_archive output) 111function(whole_archive output)
79 if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) 112 if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
80 set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE) 113 set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE)