From dfd2865d3a1a966affb07d2e240fa572c3e0ff06 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 24 Sep 2014 14:28:10 +0300 Subject: [PATCH] util/codestyle.sh: Add CMakeLists.txt whitespace and caps rules and apply them --- CMakeLists.txt | 16 ++++++++-------- todo.txt | 1 - util/codestyle.sh | 6 ++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 539d1ab..e81b42d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,8 @@ include_directories("3rdparty/smallsha1") # Global options # -SET(BUILD_SERVER TRUE CACHE BOOL "Build server") -SET(BUILD_CLIENT TRUE CACHE BOOL "Build client") +set(BUILD_SERVER TRUE CACHE BOOL "Build server") +set(BUILD_CLIENT TRUE CACHE BOOL "Build client") # # Urho3D dependency @@ -57,7 +57,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # Security / crash protection #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all") -IF(BUILD_CLIENT) +if(BUILD_CLIENT) # Client set(CLIENT_EXE_NAME buildat_client) set(CLIENT_SRCS @@ -74,15 +74,15 @@ IF(BUILD_CLIENT) add_executable(${CLIENT_EXE_NAME} ${CLIENT_SRCS}) - TARGET_LINK_LIBRARIES(${CLIENT_EXE_NAME} + target_link_libraries(${CLIENT_EXE_NAME} c55lib smallsha1 ${ABSOLUTE_PATH_LIBS} ${LINK_LIBS_ONLY} ) -ENDIF(BUILD_CLIENT) +endif(BUILD_CLIENT) -IF(BUILD_SERVER) +if(BUILD_SERVER) # Server set(SERVER_EXE_NAME buildat_server) set(SERVER_SRCS @@ -102,11 +102,11 @@ IF(BUILD_SERVER) ) add_executable(${SERVER_EXE_NAME} ${SERVER_SRCS}) - TARGET_LINK_LIBRARIES(${SERVER_EXE_NAME} + target_link_libraries(${SERVER_EXE_NAME} c55lib smallsha1 dl ${ABSOLUTE_PATH_LIBS} ${LINK_LIBS_ONLY} ) -ENDIF(BUILD_SERVER) +endif(BUILD_SERVER) diff --git a/todo.txt b/todo.txt index a1ec402..d98a278 100644 --- a/todo.txt +++ b/todo.txt @@ -16,7 +16,6 @@ Buildat TODO that Lua will dictate the function/object design) - Move self-contained library-like Lua functions from client/app.cpp to a reusable location so that they can be used from server-side Lua in the future -- util/codestyle.sh: Add some CMakeLists.txt formatting (case, whitespace) - Proper whitelisting sandbox for Urho3D's Lua API - Update testmodules/minigame to urho3d - New things in deps.txt? diff --git a/util/codestyle.sh b/util/codestyle.sh index 563e1d9..66d8f14 100755 --- a/util/codestyle.sh +++ b/util/codestyle.sh @@ -44,3 +44,9 @@ sed -i -e 's/" + /"+/g' $header_files $cpp_files sed -i -e 's/" *+$/"+/g' $header_files $cpp_files sed -i -e 's/^\(\t\+\) \+/\1\t\t/g' $header_files $cpp_files +# Format CMake too +cmake_files="$script_dir"/../CMakeLists.txt +sed -i -e 's/\(^[ \t]*\)\([A-Za-z_]\+\)[ \t]*(/\1\L\2(/' $cmake_files +sed -i -e 's/([\t ]\+\([A-Za-z_${)]\)/(\1/g' $cmake_files +sed -i -e 's/\([A-Za-z_}(]\)[\t ]\+)/\1)/g' $cmake_files +