ENH: now also the "ecosclean" target works with MS nmake

Alex
This commit is contained in:
Alexander Neundorf 2007-02-07 14:50:45 -05:00
parent 8b567083da
commit 5586c6f41b
2 changed files with 16 additions and 5 deletions

View File

@ -151,6 +151,8 @@ MACRO(ECOS_ADD_TARGET_LIB)
ADD_CUSTOM_TARGET( ecos make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile )
ENDMACRO(ECOS_ADD_TARGET_LIB)
# get the directory of the current file, used later on in the file
GET_FILENAME_COMPONENT( ECOS_CMAKE_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
#macro for creating an executable ecos application
#the first parameter is the name of the executable,
@ -204,13 +206,10 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME )
ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst;"
)
#cd $1; ls -a | grep --invert-match -e "\(.*CVS\)\|\(.*ecos\.ecc\)" | xargs rm -rf; touch ecos.ecc
ADD_CUSTOM_TARGET(ecosclean sh -c \"cd ${CMAKE_CURRENT_BINARY_DIR}/ecos\; ls | grep --invert-match -e \\\"\\\(.*CVS\\\)\\|\\\(.*ecos\\.ecc\\\)\\\" |xargs rm -rf\; touch ${ECOS_CONFIG_FILE} \")
ADD_CUSTOM_TARGET(normalclean ${CMAKE_MAKE_PROGRAM} clean -C ${CMAKE_CURRENT_BINARY_DIR})
ADD_CUSTOM_TARGET(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake )
ADD_CUSTOM_TARGET(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
ADD_DEPENDENCIES (ecosclean normalclean)
ADD_DEPENDENCIES(ecosclean clean)
ADD_CUSTOM_TARGET( listing
COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst

12
Modules/ecos_clean.cmake Normal file
View File

@ -0,0 +1,12 @@
file(GLOB _files ${ECOS_DIR}/*)
# remove all directories, which consist of lower-case letters only
# this skips e.g. CVS/ and .subversion/
foreach(_entry ${_files})
if(IS_DIRECTORY ${_entry})
get_filename_component(dir ${_entry} NAME)
if(${dir} MATCHES "^[a-z]+$")
file(REMOVE_RECURSE ${_entry})
endif(${dir} MATCHES "^[a-z]+$")
endif(IS_DIRECTORY ${_entry})
endforeach(_entry)