Skip to content

Commit d7dd3f7

Browse files
committed
cmake: remove arguments in endif()
The arguments to `else()` and `endif()` were required before version 2.6.0. As of CMake 2.6.0 the `else()` and `endif()` constructs can be empty. The same is true for closing constructs on `endmacro()`, `endfunction()`, and `endforeach()`. If you require 2.4.x compatibility, CMake 2.4.3 or greater recognizes the `CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS` option (which is superfluous in 2.6.0). See [1] and [2]. The patch removes arguments in `endif()`. 1. https://cmake.org/cmake/help/v3.6/command/endif.html 2. https://stackoverflow.com/questions/29959126/why-does-cmake-syntax-have-redundant-parentheses-everywhere/29967305#29967305
1 parent 6fa4f33 commit d7dd3f7

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ include(SetHardwareArch)
3434

3535
if (ENABLE_LUAJIT_RANDOM_RA AND NOT USE_LUAJIT)
3636
message(FATAL_ERROR "Option ENABLE_LUAJIT_RANDOM_RA is LuaJIT-specific.")
37-
endif (ENABLE_LUAJIT_RANDOM_RA AND NOT USE_LUAJIT)
37+
endif()
3838

3939
if (USE_LUA AND NOT LUA_VERSION)
4040
set(LUA_VERSION "master")
@@ -70,7 +70,7 @@ endif()
7070
find_package(Protobuf)
7171
if (NOT Protobuf_FOUND)
7272
set(ENABLE_BUILD_PROTOBUF ON)
73-
endif (NOT Protobuf_FOUND)
73+
endif()
7474

7575
SetBuildParallelLevel(CMAKE_BUILD_PARALLEL_LEVEL)
7676

cmake/CodeCoverage.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if(USE_LUAJIT)
4242
# Exclude buildvm source code, it's a project's build infrastructure.
4343
set(GCOVR_OPTIONS ${GCOVR_OPTIONS} --exclude ".*/host/")
4444
set(GCOVR_OPTIONS ${GCOVR_OPTIONS} --object-directory ${LUA_SOURCE_DIR}/src)
45-
endif (USE_LUAJIT)
45+
endif ()
4646

4747
file(MAKE_DIRECTORY ${COVERAGE_DIR})
4848
add_custom_target(${target_name})
@@ -61,7 +61,7 @@ if(USE_LUAJIT)
6161
# CMake cannot remove recursively by globbing.
6262
# Files 'src/host/*.gcda' are not used for building coverage report.
6363
set(GCDA_FILES "${LUA_SOURCE_DIR}/src/*.gcda")
64-
endif(USE_LUAJIT)
64+
endif()
6565
add_custom_target(coverage-reset
6666
COMMENT "Reset code coverage counters"
6767
COMMAND ${CMAKE_COMMAND} -E rm -f ${GCDA_FILES}

libluamut/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if (ENABLE_COV)
55
-fcoverage-mapping -ftest-coverage)
66
set(LDFLAGS ${LDFLAGS} -fprofile-instr-generate -fprofile-arcs
77
-fcoverage-mapping -ftest-coverage)
8-
endif (ENABLE_COV)
8+
endif()
99

1010
set(LIB_LUA_MUTATE lua_mutate)
1111
add_library(${LIB_LUA_MUTATE} STATIC mutate.c)

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
add_subdirectory(capi)
22
if (ENABLE_BONUS_TESTS)
33
add_subdirectory(lapi)
4-
endif (ENABLE_BONUS_TESTS)
4+
endif()

tests/capi/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ target_link_libraries(
2929

3030
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
3131
set(LDFLAGS "${LDFLAGS} ${CMAKE_C_FLAGS_DEBUG}")
32-
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
32+
endif()
3333

3434
if (ENABLE_ASAN)
3535
set(LDFLAGS "${LDFLAGS} -fsanitize=address")
36-
endif (ENABLE_ASAN)
36+
endif()
3737

3838
if (ENABLE_UBSAN)
3939
set(LDFLAGS "${LDFLAGS} -fsanitize=undefined")
40-
endif (ENABLE_UBSAN)
40+
endif()
4141

4242
if (ENABLE_COV)
4343
set(LDFLAGS "${LDFLAGS} -fprofile-instr-generate -fcoverage-mapping")
44-
endif (ENABLE_COV)
44+
endif()
4545

4646
set(DEFAULT_RUNS_NUMBER 5)
4747

@@ -96,14 +96,14 @@ function(create_test)
9696
set_tests_properties(${test_name} PROPERTIES
9797
ENVIRONMENT "ASAN_OPTIONS='detect_invalid_pointer_pairs=2'"
9898
)
99-
endif (USE_LUA)
99+
endif()
100100
set_tests_properties(${test_name} PROPERTIES
101101
LABELS capi
102102
)
103103

104104
if (USE_LUAJIT)
105105
target_compile_definitions(${test_name} PUBLIC LUAJIT)
106-
endif (USE_LUAJIT)
106+
endif()
107107
endfunction()
108108

109109
# These Lua C functions are unsupported by LuaJIT.

0 commit comments

Comments
 (0)