From 55763badae9118135126c4c623cd0c7f09183c09 Mon Sep 17 00:00:00 2001 From: Tomáš Chvátal Date: Sun, 21 Jun 2009 19:38:15 +0200 Subject: Use macro for sources addition. Fix typo in findzip. --- CMakeLists.txt | 1 + cmake/FindZIP.cmake | 2 +- cmake/MacroAddSources.cmake | 9 +++++++++ src/audio/CMakeLists.txt | 7 +------ src/base/CMakeLists.txt | 7 +------ src/client/CMakeLists.txt | 7 +------ src/net/CMakeLists.txt | 7 +------ src/screen/CMakeLists.txt | 7 +------ src/server/CMakeLists.txt | 7 +------ src/widget/CMakeLists.txt | 7 +------ 10 files changed, 18 insertions(+), 43 deletions(-) create mode 100644 cmake/MacroAddSources.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 8334e6d..db1f028 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ MESSAGE ( "Configure for ${APPNAME} Started" ) MESSAGE ( "<******************************>" ) CMAKE_MINIMUM_REQUIRED ( VERSION 2.6.0 ) CMAKE_MINIMUM_REQUIRED ( VERSION 2.6.0 FATAL_ERROR ) +INCLUDE (cmake/MacroAddSources.cmake) IF ( COMMAND cmake_policy ) cmake_policy( SET CMP0003 NEW ) ENDIF ( COMMAND cmake_policy ) diff --git a/cmake/FindZIP.cmake b/cmake/FindZIP.cmake index 1286da1..e50aedf 100644 --- a/cmake/FindZIP.cmake +++ b/cmake/FindZIP.cmake @@ -39,4 +39,4 @@ ELSE(ZIP_LIBRARIES AND ZIP_INCLUDE_DIR) ENDIF(NOT ZIP_FOUND) ENDIF(ZIP_LIBRARIES AND ZIP_INCLUDE_DIR) -MARK_AS_ADVANCED( ZIP_LIBRARY ZIP_INCLUDE_DIR ) +MARK_AS_ADVANCED( ZIP_LIBRARIES ZIP_INCLUDE_DIR ) diff --git a/cmake/MacroAddSources.cmake b/cmake/MacroAddSources.cmake new file mode 100644 index 0000000..62c1381 --- /dev/null +++ b/cmake/MacroAddSources.cmake @@ -0,0 +1,9 @@ +# This macro is for generating the sources list from in-folder files. +MACRO(MacroAddSources) + FILE ( GLOB src ${fn}/*.c ) + FOREACH ( fle ${src} ) + GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) + GET_FILENAME_COMPONENT ( pth ${fle} PATH ) + SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) + ENDFOREACH ( fle ) +ENDMACRO(MacroAddSources) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### diff --git a/src/net/CMakeLists.txt b/src/net/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/net/CMakeLists.txt +++ b/src/net/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### diff --git a/src/screen/CMakeLists.txt b/src/screen/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/screen/CMakeLists.txt +++ b/src/screen/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### diff --git a/src/widget/CMakeLists.txt b/src/widget/CMakeLists.txt index 6c8c7a1..2e93cef 100644 --- a/src/widget/CMakeLists.txt +++ b/src/widget/CMakeLists.txt @@ -3,10 +3,5 @@ ############################################################################### # Generate source_code files from .c files we find in directory ############################################################################### -FILE ( GLOB src ${fn}/*.c ) -FOREACH ( fle ${src} ) - GET_FILENAME_COMPONENT ( fnp ${fle} NAME_WE ) - GET_FILENAME_COMPONENT ( pth ${fle} PATH ) - SET ( SRC_${fn} ${SRC_${fn}} ${pth}/${fnp} ) -ENDFOREACH ( fle ) +MacroAddSources() ############################################################################### -- cgit v1.2.3