## -------------------------------------------------------------------------
FUNCTION(
- CreateLib
- lib_name
- lib_dir
- lib_type
- lib_source_files
- lib_header_files
- lib_qt_ui_files
- lib_version
- lib_short_version
+ PrepareSourceFiles
+ out_sources_list
+ out_headers_list
+ out_headers_paths
)
-## -- Configure inputs to be cmake-path compatible
-NormPaths(_sources ${lib_source_files})
-NormPaths(_headers ${lib_header_files})
-NormPaths(_qt_uis ${lib_qt_ui_files})
+SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in)
+SET(_sources_extensions .c .cpp .cxx)
+SET(_headers_extensions .h .hpp .hxx)
+SET(_qt_ui_extensions .ui)
+SET(_demangler_extensions .d)
+
+## -- Configure inputs
+SET(_all_files)
+FOREACH(_file ${ARGN})
+ GET_FILENAME_COMPONENT(_ext ${_file} EXT)
+ LIST(FIND _config_extensions ${_ext} _cfg)
+ IF(NOT ${_cfg} EQUAL -1)
+ STRING(
+ REPLACE
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+ _file_bin
+ ${_file}
+ )
+ STRING(LENGTH ${_file_bin} _file_bin_len)
+ MATH(EXPR _file_bin_len "${_file_bin_len}-3")
+ STRING(SUBSTRING ${_file_bin} 0 ${_file_bin_len} _file_bin)
+ CONFIGURE_FILE(${_file} ${_file_bin} @ONLY)
+ LIST(APPEND _all_files ${_file_bin})
+ ELSE(NOT ${_cfg} EQUAL -1)
+ LIST(APPEND _all_files ${_file})
+ ENDIF(NOT ${_cfg} EQUAL -1)
+ENDFOREACH(_file)
+
+## -- Separate files
+SET(_srcs)
+SET(_hdrs)
+SET(_qts)
+SET(_demanglers)
+FOREACH(_file ${_all_files})
+ GET_FILENAME_COMPONENT(_ext ${_file} EXT)
+ LIST(FIND _sources_extensions ${_ext} _src)
+ LIST(FIND _headers_extensions ${_ext} _hdr)
+ LIST(FIND _qt_ui_extensions ${_ext} _ui)
+ LIST(FIND _demangler_extensions ${_ext} _dem)
+ IF(NOT ${_src} EQUAL -1)
+ LIST(APPEND _srcs ${_file})
+ ENDIF(NOT ${_src} EQUAL -1)
+ IF(NOT ${_hdr} EQUAL -1)
+ LIST(APPEND _hdrs ${_file})
+ ENDIF(NOT ${_hdr} EQUAL -1)
+ IF(NOT ${_ui} EQUAL -1)
+ LIST(APPEND _qts ${_file})
+ ENDIF(NOT ${_ui} EQUAL -1)
+ IF(NOT ${_dem} EQUAL -1)
+ LIST(APPEND _demanglers ${_file})
+ ENDIF(NOT ${_dem} EQUAL -1)
+ENDFOREACH(_file)
# -- Prepare Qt4-based code
IF(Qt4_FOUND)
## -- Guess what headers sould be qt-moc'ed
- Wrap_Qt_CPP(_qt_moc_sources ${_headers})
- IF(_qt_moc_sources)
- SET(_sources ${_sources} ${_qt_moc_sources})
- ENDIF(_qt_moc_sources)
+ Wrap_Qt_CPP(_moc ${_hdrs})
+ IF(_moc)
+ LIST(APPEND _srcs ${_moc})
+ ENDIF(_moc)
## -- Guess what qt-ui's sould be qt-uic'ed
## -- Wrap qt-ui headers: this is equivalent to QT4_WRAP_UI except to change
## -- the output file
- Wrap_Qt_UI(_qt_ui_headers ${_qt_uis})
- IF(_qt_ui_headers)
- SET(_headers ${_headers} ${_qt_ui_headers})
- SET(_sources ${_sources} ${_qt_ui_headers})
- ENDIF(_qt_ui_headers)
+ Wrap_Qt_UI(_qt_hdrs ${_qts})
+ IF(_qt_hdrs)
+ LIST(APPEND _hdrs ${_qt_hdrs})
+ ENDIF(_qt_hdrs)
ENDIF(Qt4_FOUND)
-## -- Ok, compile library
-IF(_sources)
- NormPaths(_cur_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
- ADD_LIBRARY(${lib_name} ${lib_type} ${_sources} ${_headers})
- #SET_TARGET_PROPERTIES(
- # ${lib_name}
- # PROPERTIES
- # VERSION "${lib_version}"
- # SOVERSION "${lib_short_version}"
- # )
+## -- Create demanglers
+FOREACH(_d ${_demanglers})
+ STRING(
+ REPLACE
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+ _d_bin
+ ${_d}
+ )
+ GET_FILENAME_COMPONENT(_d_path ${_d_bin} DIRECTORY)
+ GET_FILENAME_COMPONENT(_out_name ${_d_bin} NAME_WE)
+ SET(_d_out ${_d_path}/${_out_name}_Demanglers.h)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_d_out}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${_d_path}
+ COMMAND ${cpPlugins_bash_CreateDemanglers_APP} ${_d} ${_out_name} ${_d_out}
+ DEPENDS ${cpPlugins_bash_CreateDemanglers_APP} ${_d}
+ )
+ LIST(APPEND _hdrs ${_d_out})
+ENDFOREACH(_d)
+
+## -- Real compilation
+SET(_hdrs_paths)
+FOREACH(_hdr ${_hdrs})
+ GET_FILENAME_COMPONENT(_path ${_hdr} DIRECTORY)
+ LIST(FIND _hdrs_paths ${_path} _path_idx)
+ IF(${_path_idx} EQUAL -1)
+ LIST(APPEND _hdrs_paths ${_path})
+ ENDIF(${_path_idx} EQUAL -1)
+ENDFOREACH(_hdr)
+
+SET(${out_sources_list} ${_srcs} PARENT_SCOPE)
+SET(${out_headers_list} ${_hdrs} PARENT_SCOPE)
+SET(${out_headers_paths} ${_hdrs_paths} PARENT_SCOPE)
+
+ENDFUNCTION()
+
+## -------------------------------------------------------------------------
+FUNCTION(
+ CreateLib
+ lib_name
+ lib_type
+ )
+PrepareSourceFiles(_srcs _hdrs _paths ${ARGN})
+INCLUDE_DIRECTORIES(
+ ${_paths}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+IF(_srcs)
+ ADD_LIBRARY(${lib_name} ${lib_type} ${_srcs} ${_hdrs})
GENERATE_EXPORT_HEADER(
${lib_name}
BASE_NAME ${lib_name}
EXPORT_FILE_NAME ${lib_name}_Export.h
STATIC_DEFINE ${lib_name}_BUILT_AS_STATIC
)
- SET(${lib_name}_LIB ${lib_name} CACHE INTERNAL "Library ${lib_name}")
-ENDIF(_sources)
-
+ IF(${prj_NAME}_All_Headers)
+ SET(_hdr_tmp "${${prj_NAME}_All_Headers};${_hdrs}")
+ ELSE(${prj_NAME}_All_Headers)
+ SET(_hdr_tmp "${_hdrs}")
+ ENDIF(${prj_NAME}_All_Headers)
+ LIST(REMOVE_DUPLICATES _hdr_tmp)
+ SET(${prj_NAME}_All_Headers ${_hdr_tmp} CACHE INTERNAL "All headers." FORCE)
+ENDIF(_srcs)
ENDFUNCTION()
## -------------------------------------------------------------------------
FUNCTION(
- LibFromDir
+ CompileLibFromDir
lib_name
- lib_dir
lib_type
- lib_source_dir
- lib_version
- lib_short_version
- )
-
-## -- Configure inputs to be cmake-path compatible
-NormPaths(_global_source_dir ${PROJECT_SOURCE_DIR})
-NormPaths(_global_binary_dir ${PROJECT_BINARY_DIR})
-NormPaths(_source_dir ${lib_source_dir})
-STRING(REPLACE "${_global_source_dir}" "" _local_source_dir ${_source_dir})
-SET(_binary_dir ${_global_binary_dir}${_local_source_dir})
-
-## -- Some useful variables
-SET(_sources_extensions .c .cpp .cxx)
-SET(_headers_extensions .h .hpp .hxx)
-SET(_qt_ui_extensions .ui)
-SET(_dirs ${_source_dir} ${_binary_dir})
-SET(_sources)
-SET(_headers)
-SET(_qt_uis)
-
-## -- Glob source code
-FOREACH(_d ${_dirs})
- FOREACH(_e ${_sources_extensions})
- FILE(GLOB_RECURSE _f "${_d}/*${_e}")
- SET(_sources ${_sources} ${_f})
- ENDFOREACH(_e)
- FOREACH(_e ${_headers_extensions})
- FILE(GLOB_RECURSE _f "${_d}/*${_e}")
- SET(_headers ${_headers} ${_f})
- ENDFOREACH(_e)
- FOREACH(_e ${_qt_ui_extensions})
- FILE(GLOB_RECURSE _f "${_d}/*${_e}")
- SET(_qt_uis ${_qt_uis} ${_f})
- ENDFOREACH(_e)
-ENDFOREACH(_d)
-
-## -- Configure some files
-FILE(GLOB_RECURSE _configs "${_source_dir}/*.in")
-FOREACH(_c ${_configs})
-
- ## -- Build input and output names
- NormPaths(_input_file ${_c})
- GET_FILENAME_COMPONENT(_input_name ${_input_file} NAME)
- GET_FILENAME_COMPONENT(_input_dir ${_input_file} DIRECTORY)
- STRING(REPLACE ".in" "" _output_name ${_input_name})
- STRING(REPLACE "${_global_source_dir}" "" _output_dir ${_input_dir})
- SET(_output_file "${_global_binary_dir}${_output_dir}/${_output_name}")
-
- ## -- Configure file
- CONFIGURE_FILE(${_input_file} ${_output_file} @ONLY)
-
- ## -- Add it to the correct list
- GET_FILENAME_COMPONENT(_output_ext ${_output_name} EXT)
- IF(
- "${_output_ext}" STREQUAL ".h"
- OR
- "${_output_ext}" STREQUAL ".hpp"
- OR
- "${_output_ext}" STREQUAL ".hxx"
- )
- SET(_headers ${_headers})
- ENDIF()
- IF(
- "${_output_ext}" STREQUAL ".c"
- OR
- "${_output_ext}" STREQUAL ".cpp"
- OR
- "${_output_ext}" STREQUAL ".cxx"
- )
- SET(_sources ${_sources})
- ENDIF()
- IF("${_output_ext}" STREQUAL ".ui")
- SET(_qt_uis ${_qt_uis})
- ENDIF()
-ENDFOREACH(_c)
-IF(ARGN)
- LIST(APPEND _sources ${ARGN})
-ENDIF(ARGN)
-
-## -- Create library
-CreateLib(
- ${lib_name} ${lib_dir} ${lib_type}
- "${_sources}" "${_headers}" "${_qt_uis}"
- "${lib_version}" "${lib_short_version}"
+ lib_dir
)
-
+FILE(GLOB_RECURSE _files "${lib_dir}/*")
+CreateLib(${lib_name} ${lib_type} ${_files} ${ARGN})
ENDFUNCTION()
## -------------------------------------------------------------------------
FUNCTION(
CompileInstances
out_lib_name
- lib_dir
def_file
number_of_files
- prefix
- version
- short_version
)
-## -- Configure inputs to be cmake-path compatible
-NormPaths(_def_file ${def_file})
-GET_FILENAME_COMPONENT(_def_name ${_def_file} NAME_WE)
-GET_FILENAME_COMPONENT(_def_dir ${_def_file} DIRECTORY)
-NormPaths(_global_source_dir ${PROJECT_SOURCE_DIR})
-NormPaths(_global_binary_dir ${PROJECT_BINARY_DIR})
-STRING(REPLACE "${_global_source_dir}" "" _out_dir ${_def_dir})
-SET(_out_base "${_global_binary_dir}${_out_dir}")
-SET(_out_header "${_out_base}/${_def_name}.h")
-SET(_lib_name "${prefix}${_def_name}")
-SET(_input_extra_code "${_global_source_dir}${_out_dir}/${_def_name}_extra.cxx")
+
+### -- Configure inputs to be cmake-path compatible
+SET(_src_dir ${CMAKE_CURRENT_SOURCE_DIR})
+SET(_bin_dir ${CMAKE_CURRENT_BINARY_DIR})
+SET(_def_file "${_src_dir}/${def_file}")
## -- Infere source code filenames
MATH(EXPR _last_range "${number_of_files}-1")
-SET(_out_code)
+SET(_out_code "${_bin_dir}/${out_lib_name}.h")
FOREACH(_n RANGE 0 ${_last_range})
- LIST(APPEND _out_code ${_out_base}/${_def_name}_${_n}.cxx)
+ LIST(APPEND _out_code ${_bin_dir}/${out_lib_name}_${_n}.cxx)
ENDFOREACH(_n)
-## -- Add extra code, if any
-SET(_all_out_code ${_out_code})
-IF(EXISTS ${_input_extra_code})
- LIST(APPEND _all_out_code ${_input_extra_code})
-ENDIF(EXISTS ${_input_extra_code})
-
## -- Command to write source code
ADD_CUSTOM_COMMAND(
- OUTPUT ${_out_header} ${_out_code}
- DEPENDS ${cpPlugins_bash_BuildInstances_APP} ${_def_file}
- COMMAND ${cpPlugins_bash_BuildInstances_APP} ${_def_file} ${_lib_name} ${_out_base}/${_def_name} ${number_of_files}
+ OUTPUT ${_out_code}
+ DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_def_file}
+ COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_def_file} ${out_lib_name} ${_bin_dir} ${number_of_files}
)
## -- Create library
-CreateLib(
- "${_lib_name}" ${lib_dir} SHARED
- "${_all_out_code}" "${_out_header}" ""
- "${version}" "${short_version}"
- )
-
-## -- Return value
-SET(${out_lib_name} ${_lib_name} PARENT_SCOPE)
+CreateLib(${out_lib_name} SHARED "${_out_code}")
ENDFUNCTION()
## -------------------------------------------------------------------------
-FUNCTION(Wrap_cpPlugins output_lib source_dir version short_version prefix)
-
-## -- Configure inputs to be cmake-path compatible
-NormPaths(_source_dir ${source_dir})
-NormPaths(_global_source_dir ${PROJECT_SOURCE_DIR})
-NormPaths(_global_binary_dir ${PROJECT_BINARY_DIR})
-STRING(REPLACE "${_global_source_dir}" "" _out_dir ${_source_dir})
-SET(_out_dir "${_global_binary_dir}${_out_dir}")
-FILE(MAKE_DIRECTORY ${_out_dir})
-GET_FILENAME_COMPONENT(_lib_name ${_source_dir} NAME_WE)
-SET(_lib_name ${prefix}${_lib_name})
-
-## -- Get source code
-FILE(GLOB_RECURSE _hdr_h "${_source_dir}/*.h")
-FILE(GLOB_RECURSE _hdr_hxx "${_source_dir}/*.hxx")
-FILE(GLOB_RECURSE _hdr_hpp "${_source_dir}/*.hpp")
-FILE(GLOB_RECURSE _src_c "${_source_dir}/*.c")
-FILE(GLOB_RECURSE _src_cxx "${_source_dir}/*.cxx")
-FILE(GLOB_RECURSE _src_cpp "${_source_dir}/*.cpp")
-FILE(GLOB_RECURSE _qt_ui "${_source_dir}/*.ui")
+FUNCTION(
+ CreatePlugin
+ lib_name
+ lib_dir
+ number_of_files
+ )
-## -- Identify sources to wrap
+GET_FILENAME_COMPONENT(_lib_dir ${lib_dir} REALPATH)
+FILE(GLOB_RECURSE _files "${_lib_dir}/*")
SET(_hdr_to_wrap)
-FOREACH(_h ${_hdr_h})
- FILE(READ ${_h} _txt)
+SET(_instances)
+FOREACH(_file ${_files})
+ FILE(READ ${_file} _txt)
STRING(FIND "${_txt}" "cpPluginsObject" _res)
IF(NOT ${_res} EQUAL -1)
- LIST(APPEND _hdr_to_wrap ${_h})
+ LIST(APPEND _hdr_to_wrap ${_file})
ENDIF(NOT ${_res} EQUAL -1)
-ENDFOREACH(_h)
-
-## -- Integrate all source files
-SET(_all_src ${_src_c} ${_src_cpp} ${_src_cxx})
-SET(_all_hdr ${_hdr_h} ${_hdr_hpp} ${_hdr_hxx})
+ GET_FILENAME_COMPONENT(_ext ${_file} EXT)
+ IF(${_ext} STREQUAL ".i")
+ LIST(APPEND _instances ${_file})
+ ENDIF(${_ext} STREQUAL ".i")
+ENDFOREACH(_file)
+
+IF(_instances)
+ FOREACH(_instance ${_instances})
+ STRING(
+ REPLACE
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+ _out_dir
+ ${_lib_dir}
+ )
+ MATH(EXPR _last_range "${number_of_files}-1")
+ SET(_out_code "${_out_dir}/${lib_name}.h")
+ FOREACH(_n RANGE 0 ${_last_range})
+ LIST(APPEND _out_code ${_out_dir}/${lib_name}_${_n}.cxx)
+ ENDFOREACH(_n)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_out_code}
+ DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_instance}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${_out_dir}
+ COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_instance} ${lib_name} ${_out_dir} ${number_of_files}
+ )
+ LIST(APPEND _files ${_out_code})
+ ENDFOREACH(_instance)
+ENDIF(_instances)
-## -- Wrap plugins
IF(_hdr_to_wrap)
- SET(_host ${_out_dir}/${_lib_name}_host.cxx)
+ STRING(
+ REPLACE
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+ _out_dir
+ ${_lib_dir}
+ )
+ SET(_host ${_out_dir}/${lib_name}_host.cxx)
ADD_CUSTOM_COMMAND(
OUTPUT ${_host}
DEPENDS ${cpPlugins_bash_HostCreator_APP} ${_hdr_to_wrap}
- COMMAND ${cpPlugins_bash_HostCreator_APP} ${_lib_name} ${_host} ${_hdr_to_wrap}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${_out_dir}
+ COMMAND ${cpPlugins_bash_HostCreator_APP} ${lib_name} ${_host} ${_hdr_to_wrap}
)
- SET(_all_src ${_all_src} ${_host})
+ LIST(APPEND _files ${_host})
ENDIF(_hdr_to_wrap)
-## -- Ok, build library
-IF(_all_src)
- CreateLib(
- ${_lib_name} leo SHARED
- "${_all_src}" "${_all_hdr}" "${_qt_ui}"
- "${version}" "${short_version}"
- ${ARGN}
- )
- SET(${output_lib} ${_lib_name} PARENT_SCOPE)
-ELSE(_all_src)
- MESSAGE(FATAL_ERROR "No source code found to build \"${_lib_name}\"")
-ENDIF(_all_src)
+CreateLib(${lib_name} SHARED ${_files})
+
ENDFUNCTION()
## -------------------------------------------------------------------------
-FUNCTION(AppFromDir output_app source_dir)
-
-## -- Configure inputs to be cmake-path compatible
-NormPaths(_global_source_dir ${PROJECT_SOURCE_DIR})
-NormPaths(_global_binary_dir ${PROJECT_BINARY_DIR})
-NormPaths(_source_dir ${source_dir})
-STRING(REPLACE "${_global_source_dir}" "" _local_source_dir ${_source_dir})
-SET(_binary_dir ${_global_binary_dir}${_local_source_dir})
-IF(${output_app})
- SET(_app_name ${${output_app}})
-ELSE(${output_app})
- GET_FILENAME_COMPONENT(_app_name ${_source_dir} NAME_WE)
-ENDIF(${output_app})
-SET(_app_name_option OFF)
-IF(ARGN)
- LIST(GET ARGN 0 _app_name_option)
-ENDIF(ARGN)
-OPTION(
- BUILD_${_app_name}
- "Build \"${_app_name}\" application"
- ${_app_name_option}
+FUNCTION(
+ CompileAppFromDir
+ app_name
+ app_dir
)
-
-## -- Real build commands
-IF(BUILD_${_app_name})
- ## -- Some useful variables
- SET(_sources_extensions .c .cpp .cxx)
- SET(_headers_extensions .h .hpp .hxx)
- SET(_qt_ui_extensions .ui)
- SET(_dirs ${_source_dir} ${_binary_dir})
- SET(_sources)
- SET(_headers)
- SET(_qt_uis)
-
- ## -- Glob source code
- FOREACH(_d ${_dirs})
- FOREACH(_e ${_sources_extensions})
- FILE(GLOB_RECURSE _f "${_d}/*${_e}")
- SET(_sources ${_sources} ${_f})
- ENDFOREACH(_e)
- FOREACH(_e ${_headers_extensions})
- FILE(GLOB_RECURSE _f "${_d}/*${_e}")
- SET(_headers ${_headers} ${_f})
- ENDFOREACH(_e)
- FOREACH(_e ${_qt_ui_extensions})
- FILE(GLOB_RECURSE _f "${_d}/*${_e}")
- SET(_qt_uis ${_qt_uis} ${_f})
- ENDFOREACH(_e)
- ENDFOREACH(_d)
-
- ## -- Configure some files
- FILE(GLOB_RECURSE _configs "${_source_dir}/*.in")
- FOREACH(_c ${_configs})
-
- ## -- Build input and output names
- NormPaths(_input_file ${_c})
- GET_FILENAME_COMPONENT(_input_name ${_input_file} NAME)
- GET_FILENAME_COMPONENT(_input_dir ${_input_file} DIRECTORY)
- STRING(REPLACE ".in" "" _output_name ${_input_name})
- STRING(REPLACE "${_global_source_dir}" "" _output_dir ${_input_dir})
- SET(_output_file "${_global_binary_dir}${_output_dir}/${_output_name}")
-
- ## -- Configure file
- CONFIGURE_FILE(${_input_file} ${_output_file} @ONLY)
-
- ## -- Add it to the correct list
- GET_FILENAME_COMPONENT(_output_ext ${_output_name} EXT)
- IF(
- "${_output_ext}" STREQUAL ".h"
- OR
- "${_output_ext}" STREQUAL ".hpp"
- OR
- "${_output_ext}" STREQUAL ".hxx"
- )
- SET(_headers ${_headers})
- ENDIF()
- IF(
- "${_output_ext}" STREQUAL ".c"
- OR
- "${_output_ext}" STREQUAL ".cpp"
- OR
- "${_output_ext}" STREQUAL ".cxx"
- )
- SET(_sources ${_sources})
- ENDIF()
- IF("${_output_ext}" STREQUAL ".ui")
- SET(_qt_uis ${_qt_uis})
- ENDIF()
- ENDFOREACH(_c)
-
- # -- Prepare Qt4-based code
- IF(Qt4_FOUND)
-
- ## -- Guess what headers sould be qt-moc'ed
- Wrap_Qt_CPP(_qt_moc_sources ${_headers})
- IF(_qt_moc_sources)
- SET(_sources ${_sources} ${_qt_moc_sources})
- ENDIF(_qt_moc_sources)
- ## -- Guess what qt-ui's sould be qt-uic'ed
- ## -- Wrap qt-ui headers: this is equivalent to QT4_WRAP_UI except to
- ## -- change the output file
- Wrap_Qt_UI(_qt_ui_headers ${_qt_uis})
- IF(_qt_ui_headers)
- SET(_headers ${_headers} ${_qt_ui_headers})
- SET(_sources ${_sources} ${_qt_ui_headers})
- ENDIF(_qt_ui_headers)
- ENDIF(Qt4_FOUND)
-
- ## -- Ok, compile application
- IF(_sources)
- SET(_gui_type "")
- IF(WIN32)
- SET(_gui_type WIN32)
- ENDIF(WIN32)
- IF(APPLE)
- SET(_gui_type MACOSX_BUNDLE)
- ENDIF(APPLE)
- ADD_EXECUTABLE(${_app_name} ${_gui_type} ${_sources})
- SET(${output_app} ${_app_name} PARENT_SCOPE)
- ELSE(_sources)
- SET(${output_app} "" PARENT_SCOPE)
- MESSAGE(FATAL_ERROR "No source code found to build \"${_app_name}\"")
- ENDIF(_sources)
-ENDIF(BUILD_${_app_name})
-
+FILE(GLOB_RECURSE _files "${app_dir}/*")
+PrepareSourceFiles(_srcs _hdrs _paths ${_files} ${ARGN})
+INCLUDE_DIRECTORIES(
+ ${_paths}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+IF(_srcs)
+ SET(_app_os_target)
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ SET(_app_os_target WIN32)
+ ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+ SET(_app_os_target MACOSX_BUNDLE)
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs})
+ENDIF(_srcs)
ENDFUNCTION()
## eof - $RCSfile$