aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorGraham Bloice <graham.bloice@trihedral.com>2016-03-11 19:51:39 +0000
committerGraham Bloice <graham.bloice@trihedral.com>2016-05-02 12:01:24 +0000
commit2e23b506c766d98966ed213c760b2aa6232ba1fe (patch)
treee15eec1049e10419d869dea459730791ec2bc128 /cmake
parent231f6b5035e4f001eca22029b58cf4c498d624bd (diff)
Add checkAPI calls to CMake.
This generates a top level target, checkAPI, that is excluded from the ALL build target, so must be run separately. On Windows using a Visual Studio generator, call msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj Change-Id: I44a57c564dcfc75499463b942436f4b920a82478 Reviewed-on: https://code.wireshark.org/review/14873 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindLEX.cmake5
-rw-r--r--cmake/modules/FindYACC.cmake5
-rw-r--r--cmake/modules/UseCheckAPI.cmake42
-rw-r--r--cmake/modules/UseLemon.cmake5
4 files changed, 42 insertions, 15 deletions
diff --git a/cmake/modules/FindLEX.cmake b/cmake/modules/FindLEX.cmake
index ec53b04acd..adeb75c07a 100644
--- a/cmake/modules/FindLEX.cmake
+++ b/cmake/modules/FindLEX.cmake
@@ -26,7 +26,7 @@ MARK_AS_ADVANCED(LEX_EXECUTABLE)
# flex a .l file
-MACRO(ADD_LEX_FILES _sources )
+MACRO(ADD_LEX_FILES _source _generated)
FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
@@ -41,7 +41,8 @@ MACRO(ADD_LEX_FILES _sources )
${_in}
DEPENDS ${_in}
)
- SET(${_sources} ${${_sources}} ${_outc} )
+ LIST(APPEND ${_source} ${_in})
+ LIST(APPEND ${_generated} ${_outc})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ENDFOREACH (_current_FILE)
diff --git a/cmake/modules/FindYACC.cmake b/cmake/modules/FindYACC.cmake
index 672a780e7d..dca1c09fa8 100644
--- a/cmake/modules/FindYACC.cmake
+++ b/cmake/modules/FindYACC.cmake
@@ -24,7 +24,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(YACC DEFAULT_MSG YACC_EXECUTABLE)
MARK_AS_ADVANCED(YACC_EXECUTABLE)
-MACRO(ADD_YACC_FILES _sources )
+MACRO(ADD_YACC_FILES _source _generated)
FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
@@ -40,7 +40,8 @@ MACRO(ADD_YACC_FILES _sources )
${_in}
DEPENDS ${_in}
)
- SET(${_sources} ${${_sources}} ${_out} )
+ LIST(APPEND ${_source} ${_in})
+ LIST(APPEND ${_generated} ${_out})
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_YACC_FILES)
diff --git a/cmake/modules/UseCheckAPI.cmake b/cmake/modules/UseCheckAPI.cmake
index 334f5054a5..1518fb4fe8 100644
--- a/cmake/modules/UseCheckAPI.cmake
+++ b/cmake/modules/UseCheckAPI.cmake
@@ -1,17 +1,41 @@
+# Add a target to call checkAPIs.pl on the specified source files
+# The target is excluded from the ALL targte so must be manually
+# specified in a build command.
+# The target is added to the top-level checkAPIs target
#
+# Parameters:
+# NAME: The name of the target, must be unique
+# SWITCHES: Switches to be supplied to the script
+# SOURCES: The sources to be checked
+
+include(CMakeParseArguments)
+
macro( CHECKAPI )
- set( _sources ${ARGN} )
+ cmake_parse_arguments(CHECKAPI "DEBUG" "" "NAME;SWITCHES;SOURCES" ${ARGN} )
+
+ if (CHECKAPI_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "CHECKAPIS Unknown argument: ${CHECKAPI_UNPARSED_ARGUMENTS}")
+ endif()
- ADD_CUSTOM_TARGET(checkapi
+ if( CHECKAPI_DEBUG )
+ set (CHECKAPI_SWITCHES ${CHECKAPI_SWITCHES --debug)
+ endif()
+
+ set(TARGET_NAME checkAPI_${CHECKAPI_NAME})
+ add_custom_target(${TARGET_NAME}
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tools/checkAPIs.pl
- -build
- ${_sources}
+ ${CHECKAPI_SWITCHES}
+ ${CHECKAPI_SOURCES}
WORKING_DIRECTORY
- ${CMAKE_SOURCE_DIR}
- DEPENDS
- ${CMAKE_SOURCE_DIR}/tools/checkAPIs.pl
- ${_sources}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT
+ "Running ${TARGET_NAME}"
+ )
+ add_dependencies(checkAPI ${TARGET_NAME})
+ set_target_properties(${TARGET_NAME}
+ PROPERTIES FOLDER "Auxiliary/CheckAPIs"
+ EXCLUDE_FROM_ALL True
+ EXCLUDE_FROM_DEFAULT_BUILD True
)
- set_target_properties(checkapi PROPERTIES FOLDER "Auxiliary")
ENDMACRO()
diff --git a/cmake/modules/UseLemon.cmake b/cmake/modules/UseLemon.cmake
index 6e97144d12..9332b151f6 100644
--- a/cmake/modules/UseLemon.cmake
+++ b/cmake/modules/UseLemon.cmake
@@ -1,5 +1,5 @@
#
-MACRO(ADD_LEMON_FILES _sources )
+MACRO(ADD_LEMON_FILES _source _generated)
set(_lemonpardir ${CMAKE_SOURCE_DIR}/tools/lemon)
FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
@@ -22,6 +22,7 @@ MACRO(ADD_LEMON_FILES _sources )
${_lemonpardir}/lempar.c
)
- SET(${_sources} ${${_sources}} ${_out}.c )
+ LIST(APPEND ${_source} ${_in})
+ LIST(APPEND ${_generated} ${_out}.c)
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_LEMON_FILES)