Fix coding style

This commit is contained in:
Dragos Carp 2016-08-06 17:50:42 +02:00
commit 18c7e125bf
28 changed files with 412 additions and 433 deletions

View file

@ -4,30 +4,30 @@ cmake_minimum_required(VERSION 2.8.1)
# We must explicitly indicate we're using the D language
# in the project declaration. Listing other languages
# is fine.
PROJECT (CMAKE-D_TESTS C D )
SET( GLOBAL_DMD_DEFS "-w" )
SET( GLOBAL_GCC_DEFS "-Wall -pedantic" )
project(CMAKE-D_TESTS C D)
set(GLOBAL_DMD_DEFS "-w")
set(GLOBAL_GCC_DEFS "-Wall -pedantic")
# Don't use ADD_DEFINITIONS() with a mixed C + D project
# Don't use add_definitions() with a mixed C + D project
# since that adds the same flags to both C and D builds.
# Also, the D linker preference is set to 40, which is
# higher than C++ (30) and C (10). This causes CMAKE
# to use the D linker in mixed linking cases.
# Append our own definitions to the defaults.
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLOBAL_GCC_DEFS}" )
SET( CMAKE_D_FLAGS "${CMAKE_D_FLAGS} ${GLOBAL_DMD_DEFS}" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLOBAL_GCC_DEFS}")
set(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} ${GLOBAL_DMD_DEFS}")
enable_testing()
# build libs first, then apps
ADD_SUBDIRECTORY (lib_1)
ADD_SUBDIRECTORY (lib_2)
ADD_SUBDIRECTORY (app_1)
ADD_SUBDIRECTORY (app_2)
ADD_SUBDIRECTORY (app_3)
ADD_SUBDIRECTORY (app_5)
ADD_SUBDIRECTORY (app_4)
ADD_SUBDIRECTORY (app_6)
ADD_SUBDIRECTORY (app_7)
ADD_SUBDIRECTORY (app_8)
ADD_SUBDIRECTORY (app_9)
add_subdirectory(lib_2)
add_subdirectory(lib_1)
add_subdirectory(app_1)
add_subdirectory(app_2)
add_subdirectory(app_3)
add_subdirectory(app_5)
add_subdirectory(app_4)
add_subdirectory(app_6)
add_subdirectory(app_7)
add_subdirectory(app_8)
add_subdirectory(app_9)

View file

@ -1,2 +1,2 @@
ADD_EXECUTABLE( app_1 app_1.d )
ADD_TEST( app_1 app_1 )
add_executable(app_1 app_1.d)
add_test(app_1 app_1)

View file

@ -1,2 +1,2 @@
ADD_EXECUTABLE( app_2 app_2.d )
ADD_TEST( app_2 app_2 )
add_executable(app_2 app_2.d)
add_test(app_2 app_2)

View file

@ -1,4 +1,4 @@
ADD_EXECUTABLE ( app_3 app_3.d )
INCLUDE_DIRECTORIES( app_3 ${PROJECT_SOURCE_DIR} )
TARGET_LINK_LIBRARIES ( app_3 lib_1 )
ADD_TEST( app_3 app_3 )
add_executable(app_3 app_3.d)
include_directories(app_3 ${PROJECT_SOURCE_DIR})
add_test(app_3 app_3)
target_link_libraries(app_3 lib_1)

View file

@ -3,7 +3,7 @@
# The linker preference of D is higher than C (or CXX), so after
# the objects are created, the D toolchain will drive linking.
#
ADD_EXECUTABLE ( app_4 app_4.d )
INCLUDE_DIRECTORIES( app_4 ${PROJECT_SOURCE_DIR} )
TARGET_LINK_LIBRARIES( app_4 lib_2 )
ADD_TEST( app_4 app_4 )
add_executable(app_4 app_4.d)
include_directories(app_4 ${PROJECT_SOURCE_DIR})
add_test(app_4 app_4)
target_link_libraries(app_4 lib_2)

View file

@ -3,13 +3,5 @@
# The linker preference of D is higher than C (or CXX), so after
# the objects are created, the D toolchain will drive linking.
#
# TODO
# dirty fix
# we should make the CMAKE_D_COMPILER_ID work
#
# This 32-bit environment check no longer needed as of dmd 2.053 on Linux
#IF("${CMAKE_BASE_NAME}" MATCHES "dmd")
# SET(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}" )
#ENDIF()
ADD_EXECUTABLE ( app_5 app_5.d cfunc.c )
ADD_TEST( app_5 app_5 )
add_executable(app_5 app_5.d cfunc.c)
add_test(app_5 app_5)

View file

@ -1,2 +1,2 @@
ADD_EXECUTABLE( app_6 app_6.d )
ADD_TEST( app_6 app_6 )
add_executable(app_6 app_6.d)
add_test(app_6 app_6)

View file

@ -1,3 +1,3 @@
# A more complex library test.
ADD_EXECUTABLE( app_7 app_7.d )
ADD_TEST( app_7 app_7 )
add_executable(app_7 app_7.d)
add_test(app_7 app_7)

View file

@ -7,7 +7,7 @@ include(UseDUnittest)
# add all files
file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.d")
foreach(file IN LISTS files)
add_unittests(${file})
add_unittests(${file})
endforeach()
#add_unittests(moduleA.d)

View file

@ -1 +1 @@
ADD_LIBRARY (lib_1 lib_1.d)
add_library(lib_1 lib_1.d)

View file

@ -1,11 +1,3 @@
# This project is a C library
PROJECT( lib_2 C )
# TODO
# dirty fix
# we should make the CMAKE_D_COMPILER_ID work
#
# This 32-bit environment check no longer needed as of dmd 2.053 on Linux
#IF("${CMAKE_BASE_NAME}" MATCHES "dmd")
# SET(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}" )
#ENDIF()
ADD_LIBRARY( lib_2 STATIC lib_2.c )
project(lib_2 C)
add_library(lib_2 STATIC lib_2.c)