HI Caspar, Thanks. I can use the way Joao mentioned to build Step 8 successfully. I also created another version of cmake file based on MITK-ProjectTemplate, shown below. But I got error as:
.../Tutorial/Step8/../Step6/Step6.h:22:39: fatal error: mitkStandaloneDataStorage.h: No such file or directory #include <mitkStandaloneDataStorage.h> ^ compilation terminated. make[2]: *** [CMakeFiles/Step8.dir/Step8.cpp.o] Error 1 make[1]: *** [CMakeFiles/Step8.dir/all] Error 2 make: *** [all] Error 2 What did I miss? CMakeLists.txt ===================================================== cmake_minimum_required(VERSION 3.2 FATAL_ERROR) project(Step8) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) include_directories(..) include_directories(../Step6) find_package(MITK REQUIRED) link_directories(${MITK_LINK_DIRECTORIES}) set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) # Check that MITK has been build with Qt support if(NOT MITK_USE_QT) message(SEND_ERROR "MITK needs to be built with MITK_USE_QT set to ON") endif() set(CPP_FILES Step8.cpp Step8main.cpp ../Step6/Step6RegionGrowing1.cpp ../Step6/Step6RegionGrowing2.cpp ../Step6/Step6RegionGrowing3.cpp ../Step6/Step6.cpp ../Step7/Step7.cpp ../QtTesting.cpp ) set(MOC_H_FILES ../Step6/Step6.h ../Step7/Step7.h Step8.h ) add_executable(${PROJECT_NAME} ${MOC_H_FILES} ${CPP_FILES}) target_link_libraries(${PROJECT_NAME} ${MITK_LIBRARIES} ${ITK_LIBRARIES} Qt5::Widgets) ================================================================================ Thanks, Hongzhi ________________________________________ From: Goch, Caspar Jonas <c.g...@dkfz-heidelberg.de> Sent: Tuesday, November 03, 2015 1:50 AM To: Hongzhi Lan; Kislinskiy, Stefan; 'mitk-users@lists.sourceforge.net' Subject: AW: Build tutorial steps with CMake Hi Hongzhi, in my opinion it is not necessarily advisable to start by excising some part of MITK in order to get to grips with the build system. You could take a look at [1] and the project template [2] to have an example of a CMake based project using MITK. Depending on whether or not you intend to use the GUI and application framework part of MITK you might have to fiddle with the CMakeExternals/MITK.cmake [3] Hope this helps, Caspar [1] http://docs.mitk.org/2015.05/HowToNewProject.html [2] https://github.com/MITK/MITK-ProjectTemplate [3] https://github.com/MITK/MITK-ProjectTemplate/blob/master/CMakeExternals/MITK.cmake -----Ursprüngliche Nachricht----- Von: Hongzhi Lan [mailto:hong...@stanford.edu] Gesendet: Montag, 2. November 2015 21:42 An: Kislinskiy, Stefan; mitk-users@lists.sourceforge.net Betreff: Re: [mitk-users] Build tutorial steps with CMake Thanks for your prompt reply. But my goal is not just to build the examples. I want to use MITK as a "toolkit", so I have to create my own cmakelists.txt to build the examples and later I can create/build my own project using MITK as a toolkit. Thanks, Hongzhi ________________________________________ From: Kislinskiy, Stefan <s.kislins...@dkfz-heidelberg.de> Sent: Monday, November 02, 2015 12:13 PM To: Hongzhi Lan; mitk-users@lists.sourceforge.net Subject: AW: Build tutorial steps with CMake Hi, the tutorial steps are included in MITK. Just enable MITK_BUILD_EXAMPLES in CMake. Best, Stefan ________________________________________ Von: Hongzhi Lan [hong...@stanford.edu] Gesendet: Montag, 2. November 2015 21:05 An: mitk-users@lists.sourceforge.net Betreff: [mitk-users] Build tutorial steps with CMake Hi, After I successfully built/ran MITK, I want to create my own cmakelists.txt to build step 1~10 in the MITK tutorial (using MITK as a toolkit). I checked the list archive. One post (http://sourceforge.net/p/mitk/mailman/message/27520536/) talked about this but it's too old (2011). Could someone give me a complete example? Some posts mentioned using MITK project template or Plugin Generator, which I think mainly for developing plugins, not for using MITK as a toolkit. My envirionment/tool: MITK: 2015.5.2 OS: Ubuntu 14.04 Compiler: gcc 4.8.4 CMake: 3.2.1 Thanks a lot! Hongzhi ------------------------------------------------------------------------------ _______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ _______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users