Skip to content

Commit

Permalink
Macro used to initialize project for library or
Browse files Browse the repository at this point in the history
executable.
  • Loading branch information
elpablo committed Oct 14, 2010
1 parent 3ab930c commit 25e3109
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions CMake/mafMacroInitProject.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
MACRO(mafMacroInitProject test)

# Extract current directory name to use as project name
file(GLOB CUR_FILE "CMakeLists.txt")
get_filename_component(CUR_ABSOLUTE_DIR ${CUR_FILE} PATH)
get_filename_component(DIR_NAME ${CUR_ABSOLUTE_DIR} NAME)
PROJECT(${DIR_NAME})

FILE(GLOB include_file_list "${PROJECT_SOURCE_DIR}/*.h")
FILE(GLOB implementation_file_list "${PROJECT_SOURCE_DIR}/*.cpp")
FILE(GLOB templete_file_list1 "${PROJECT_SOURCE_DIR}/*.txx")
FILE(GLOB templete_file_list2 "${PROJECT_SOURCE_DIR}/*.tpp")
# Set your list of sources here.
SET(PROJECT_SRCS
${implementation_file_list}
${include_file_list}
${templete_file_list1}
${templete_file_list2}
)

set(MY_MOC_CXX )
if(${test})
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
foreach(FILE_NAME_ABS ${implementation_file_list})
get_filename_component(FILE_NAME ${FILE_NAME_ABS} NAME_WE)
set(MOC_FILE "${FILE_NAME}.moc")
QT4_GENERATE_MOC(${FILE_NAME_ABS} ${MOC_FILE})
LIST(APPEND MY_MOC_CXX "${PROJECT_BINARY_DIR}/${MOC_FILE}")
endforeach()
else(${test})
QT4_WRAP_CPP(MY_MOC_CXX ${include_file_list})
endif(${test})

# List libraries that are needed by this project.
mafMacroGetTargetLibraries(dependency_libraries)
SET(PROJECT_LIBS ${dependency_libraries})

ENDMACRO()
Expand Down

0 comments on commit 25e3109

Please sign in to comment.