cpPlugins_NormalizePaths(_source_dir ${source_dir})
STRING(REPLACE "${_global_source_dir}" "" _local_source_dir ${_source_dir})
SET(_binary_dir ${_global_binary_dir}${_local_source_dir})
-GET_FILENAME_COMPONENT(_app_name ${_source_dir} NAME_WE)
-OPTION(BUILD_${_app_name} "Build \"${_app_name}\" application" OFF)
+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}
+ )
+## -- Real build commands
IF(BUILD_${_app_name})
-
## -- Some useful variables
SET(_sources_extensions .c .cpp .cxx)
SET(_headers_extensions .h .hpp .hxx)
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
ADD_EXECUTABLE(${_app_name} ${_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})