ENDIF(CREA_VERBOSE_CMAKE)
#-----------------------------------------------------------------------------
-# If crea was compiled with WxWidget or vtk then have to find them
-IF(CREA_BUILT_WITH_WX OR CREA_BUILT_WITH_VTK)
- INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_Define.cmake)
-ENDIF(CREA_BUILT_WITH_WX OR CREA_BUILT_WITH_VTK)
-IF(CREA_BUILT_WITH_WX)
- IF(NOT wxWidgets_FOUND)
- MESSAGE(STATUS "=======================================")
- MESSAGE(STATUS "crea was built with wxWidgets: have to find it...")
- INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
- CREA_FIND_AND_USE_WXWIDGETS()
- ENDIF(NOT wxWidgets_FOUND)
-ENDIF(CREA_BUILT_WITH_WX)
-IF(CREA_BUILT_WITH_VTK)
- IF (NOT VTK_FOUND)
- MESSAGE(STATUS "=======================================")
- MESSAGE(STATUS "crea was built with VTK: have to find it...")
- INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
- CREA_FIND_AND_USE_VTK()
- ENDIF (NOT VTK_FOUND)
-ENDIF(CREA_BUILT_WITH_VTK)
+# If crea was compiled with WxWidget or vtk then have to find them
+#IF(CREA_BUILT_WITH_WX OR CREA_BUILT_WITH_VTK)
+# INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_Define.cmake)
+#ENDIF(CREA_BUILT_WITH_WX OR CREA_BUILT_WITH_VTK)
+#IF(CREA_BUILT_WITH_WX)
+# IF(NOT wxWidgets_FOUND)
+# MESSAGE(STATUS "=======================================")
+# MESSAGE(STATUS "crea was built with wxWidgets: have to find it...")
+# INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
+# CREA_FIND_AND_USE_WXWIDGETS()
+# ENDIF(NOT wxWidgets_FOUND)
+#ENDIF(CREA_BUILT_WITH_WX)
+#IF(CREA_BUILT_WITH_VTK)
+# IF (NOT VTK_FOUND)
+# MESSAGE(STATUS "=======================================")
+# MESSAGE(STATUS "crea was built with VTK: have to find it...")
+# INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
+# CREA_FIND_AND_USE_VTK()
+# ENDIF (NOT VTK_FOUND)
+#ENDIF(CREA_BUILT_WITH_VTK)
SET(EXE_NAME creaNewProject)
SET(${EXE_NAME}_SOURCES creaNewProject.cpp)
+SET(${EXE_NAME}_HAS_GUI TRUE)
SET(${EXE_NAME}_CONSOLE FALSE)
SET(${EXE_NAME}_LINK_LIBRARIES crea)
-CREA_ADD_WX_EXECUTABLE( ${EXE_NAME} )
+CREA_ADD_EXECUTABLE( ${EXE_NAME} )
#============================================================================
-#
-# Test CMake version
-#
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-#MARK_AS_ADVANCED( FORCE CMAKE_BACKWARDS_COMPATIBILITY )
-
-# for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
-IF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
- CMAKE_POLICY(SET CMP0003 NEW)
- CMAKE_POLICY(SET CMP0005 NEW)
-ENDIF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+###################################
PROJECT(PROJECT_NAME)
+###################################
+#==================================
+# The project version
SET(PROJECT_MAJOR_VERSION 1)
SET(PROJECT_MINOR_VERSION 0)
SET(PROJECT_BUILD_VERSION 0)
+#==================================
+#==================================
+# Find crea
SET(CREA_VERBOSE_CMAKE TRUE)
-
FIND_PACKAGE(crea REQUIRED)
IF (crea_FOUND)
INCLUDE(${crea_USE_FILE})
ENDIF(crea_FOUND)
+#==================================
+#==================================
+# Do not allow to build inside the source tree
CREA_PREVENT_IN_SOURCE_BUILD()
-
-SET(USE_GDCM OFF)
-SET(USE_GDCM_VTK OFF)
+#==================================
+
+#==================================
+# Libraries/tools used
+# Note : Set USE_CREA to ON
+# if you need to LINK against crea
+# (and not only use its macros)
+SET(USE_CREA OFF)
+SET(USE_GDCM OFF)
+SET(USE_GDCM_VTK OFF)
+SET(USE_GDCM2 OFF)
SET(USE_WXWIDGETS OFF)
-SET(USE_VTK OFF)
-SET(USE_ITK OFF)
-SET(USE_BOOST OFF)
-
+SET(USE_KWWIDGETS OFF)
+SET(USE_VTK OFF)
+SET(USE_ITK OFF)
+SET(USE_BOOST OFF)
+SET(USE_DOXYGEN OFF)
+SET(USE_LATEX OFF)
+SET(USE_TTH OFF)
CREA_FIND_AND_USE_LIBRARIES()
+#==================================
+#==================================
+# Where to put executables and libs
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
MARK_AS_ADVANCED(
CMAKE_BACKWARDS_COMPATIBILITY
- EXECUTABLE_OUTPUT_PATH
+ EXECUTABLE_OUTPUT_PATH
LIBRARY_OUTPUT_PATH
)
+#==================================
+#==================================
+# Subdirs
SUBDIRS(appli)
SUBDIRS(lib)
+#==================================
# Add a SUBDIRS command for each of your applications
-# SUBDIRS(myapp1)
-# SUBDIRS(myapp2)
+# SUBDIRS(MyApp1)
+# SUBDIRS(MyApp2)
#----------------------------------------------------------------------------
# DEPENDENCIES (LIBRARIES TO LINK WITH)
SET ( ${EXE_NAME}_LINK_LIBRARIES
- ${crea_LIBRARIES}
+ # ${crea_LIBRARIES}
# ${WXWIDGETS_LIBRARIES}
+ # ${KWWidgets_LIBRARIES}
# ${VTK_LIBRARIES}
# ${ITK_LIBRARIES}
# ${GDCM_LIBRARIES}
#----------------------------------------------------------------------------
# CREATES AND INSTALLS THE EXE
+# Set to ON if your appli has a GUI (to build as a Win32 app on windows)
+SET(${EXE_NAME}_HAS_GUI OFF)
+# Set to ON if your appli has a GUI but you also want a msdos console on windows
+SET(${EXE_NAME}_CONSOLE OFF)
CREA_ADD_EXECUTABLE( ${EXE_NAME} )
#----------------------------------------------------------------------------
+++ /dev/null
-#----------------------------------------------------------------------------
-# SET THE NAME OF YOUR EXECUTABLE
-SET ( EXE_NAME MyExe )
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# EXECUTABLE SOURCES (TO BE COMPILED)
-# EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
-FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc)
-# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
-# SET ( ${EXE_NAME}_SOURCES
-#
-# )
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# DEPENDENCIES (LIBRARIES TO LINK WITH)
-SET ( ${EXE_NAME}_LINK_LIBRARIES
- ${crea_LIBRARIES}
- # ${WXWIDGETS_LIBRARIES}
- # ${VTK_LIBRARIES}
- # ${ITK_LIBRARIES}
- # ${GDCM_LIBRARIES}
- # ${BOOST_LIBRARIES}
- )
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# UNCOMMENT NEXT LINE IF YOU WANT A CONSOLE ON WINDOWS
-# NB : YOUR MAIN MUST BE ADAPTED ALSO
-# SEE THE MACRO CREA_WXMAIN_WITH_CONSOLE IN creaWx.h
-#SET(${EXE_NAME}_CONSOLE TRUE)
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# CREATES AND INSTALLS THE EXE
-CREA_ADD_WX_EXECUTABLE( ${EXE_NAME} )
-#----------------------------------------------------------------------------
-
-
# Add a SUBDIRS command for each of your libraries
-# SUBDIRS(template_lib)
+# SUBDIRS(MyLib1)
-#include <stdio.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
-
- void replace( std::string& str,
- const std::string& from,
- const std::string& to )
- {
- using std::string;
- string::size_type pos = str.find( from );
- while ( pos != string::npos )
- {
- str.replace( pos, from.size(), to );
- pos = str.find( from, pos+from.size()-1 );
- }
- }
-
-
+//==========================================================================
+void replace(std::string& str,
+ const std::string& from,
+ const std::string& to )
+{
+ std::string::size_type pos = str.find( from );
+ while ( pos != std::string::npos )
+ {
+ str.replace( pos, from.size(), to );
+ pos = str.find( from, pos+from.size()-1 );
+ }
+}
+//==========================================================================
//==========================================================================
}
fclose(ffIn);
} else {
- std::cerr << "ERROR. File : "<< argv[1] <<" Not exists." << std::endl;
+ std::cerr << "ERROR. File : "<< argv[1] <<" does not exists." << std::endl;
return 1;
}
MACRO(CREA_FIND_AND_USE_LIBRARIES)
+#-----------------------------------------------------------------------------
+# If one can invoke this macro then crea has already been found !!
+# However if one whishes to link against crea and crea was built
+# with wx or vtk then we have to find them.
+# This USE_CREA var is made to resolve this dependency.
+IF(USE_CREA)
+ IF(CREA_BUILT_WITH_WX)
+ SET(USE_WXWIDGETS ON)
+ ENDIF(CREA_BUILT_WITH_WX)
+ IF(CREA_BUILT_WITH_VTK)
+ SET(USE_VTK ON)
+ ENDIF(CREA_BUILT_WITH_VTK)
+ENDIF(USE_CREA)
+#-----------------------------------------------------------------------------
+
+
#-----------------------------------------------------------------------------
IF(USE_VTK)
INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
#-----------------------------------------------------------------------------
-IF(USE_LATEX)
+IF(USE_LATEX)
IF (NOT LATEX_COMPILER)
FIND_PACKAGE(LATEX REQUIRED)
MESSAGE ( STATUS "=======================================")