0

I built VTK-8.0.0 (using msvc2017_64) and ITK-4.12.0 (using msvc2017_64). During the ITK-build as below:


1) building VTK (CMake3.9.0)

2) building ITK (CMake3.9.0): Module_ITKVtkGlue + VTK_DIR this path C:\VTK\8.0.0\build\msvc2017_64

3) Compiling VTK using msvc2017 (in Release mode)

4) Create a new environment variable VTK_DIR with the value C:\VTK\8.0.0\build\msvc2017_64

5) Add to the path: %VTK_DIR%\bin\Release

6) Compiling ITK using msvc2017 (in Release mode)

7) Creating a new environment variable ITK_DIR with the value C:\ITK\4.12.0\build\msvc2017_64

8) Add to the path: %ITK_DIR%\bin\Release


And now, I only want to build and compile a very simple project from the link below: https://itk.org/Wiki/ITK/Examples/IO/ImageToVTKImageFilter

however, I can't configure the project getting the error below in CMake:

***************************************************************

CMake Error at C:/ITK/4.12.0/build/msvc2017_64/lib/cmake/ITK-4.12/Modules/ITKVtkGlue.cmake:14 (set):
  Syntax error in cmake code at

    C:/ITK/4.12.0/build/msvc2017_64/lib/cmake/ITK-4.12/Modules/ITKVtkGlue.cmake:14

  when parsing string

    C:\VTK\8.0.0\build\msvc2017_64

  Invalid escape sequence \V
Call Stack (most recent call first):
  C:/ITK/4.12.0/src/CMake/ITKModuleAPI.cmake:54 (include)
  C:/ITK/4.12.0/src/CMake/ITKModuleAPI.cmake:26 (itk_module_load)
  C:/ITK/4.12.0/src/CMake/ITKModuleAPI.cmake:84 (_itk_module_config_recurse)
  C:/ITK/4.12.0/build/msvc2017_64/ITKConfig.cmake:74 (itk_module_config)
  CMakeLists.txt:6 (find_package)


Configuring incomplete, errors occurred!
See also "C:/new_dev/tests/ImageToVTKImageFilter/build/CMakeFiles/CMakeOutput.log".
***************************************************************

To solve this problem, at first, I tried to add an Entry with ItkVtkGlue path but the same error was achieved. Then, I created ItkVtkGlue.lib individually and added added a new environment variable ItkVtkGlue_DIR with the value C:\ItkVtkGlue\build\Release and also added to the path and again creating an Entry for ItkVtkGlue, but I got the same error.

I would appreciate any help... Deeply looking forward to your advice ...

Dženan
  • 3,329
  • 3
  • 31
  • 44
ir0098
  • 127
  • 1
  • 13
  • 1
    `Create a new environment variable VTK_DIR with the value 'C:\VTK\8.0.0\build\msvc2017_64'` - When set path variables for CMake, do not use backslash in them, use forward slash instead: `C:/VTK/8.0.0/build/msvc2017_64`. – Tsyvarev Jul 28 '17 at 06:46
  • 1
    Possible duplicate of [Cmake error: Invalid escape sequence \U](https://stackoverflow.com/questions/13737370/cmake-error-invalid-escape-sequence-u) – Tsyvarev Jul 28 '17 at 06:46
  • First of all, thanks, I did it, again the same error. please have a look at https://ibb.co/cZNr9k *** just a kind reminder, when building an individual itk or vtk project, it goes well, but in the case of itk+vtk, I got such an error... – ir0098 Jul 28 '17 at 07:04
  • What is content of the line error log refers to (`/ITK/4.12.0/build/msvc2017_64/lib/cmake/ITK-4.12/Modules/ITKVtkGlue.cmake:14`)? – Tsyvarev Jul 28 '17 at 07:16
  • Could you please have a look at: https://ufile.io/vh05b and https://ufile.io/ss2qb – ir0098 Jul 28 '17 at 07:28
  • `CMakeCache.txt` and output are not interesting (at least, at now). I asked about the particular line in the file which exists only on your PC. – Tsyvarev Jul 28 '17 at 07:40
  • sorry, I uploaded the wrong file, you can find CMakeError here: https://ufile.io/0ycrr – ir0098 Jul 28 '17 at 07:45
  • 1
    File `/ITK/4.12.0/build/msvc2017_64/lib/cmake/ITK-4.12/Modules/IT‌​KVtkGlue.cmake` is not an error log. This is a normal file, but its content depends on your machine (more precise, it depends on installation of VTK). – Tsyvarev Jul 28 '17 at 07:48
  • So sorry Tsyvarev, I just got what you meant... I'll come back in a minute... – ir0098 Jul 28 '17 at 07:57
  • 1
    You were right, the problem was about the VTK address in the IKVtkGlue.cmake. In fact, the VTK_DIR was set to "C:\VTK\8.0.0\build\msvc2017_64". II changed to set(VTK_DIR "C:/VTK/8.0.0/build/msvc2017_64") and it works now. Thanks Tsyvarev for your guides. – ir0098 Jul 28 '17 at 08:12
  • You can simplify your life by building VTK and ITK as static libraries, by setting BUILD_SHARED_LIBS to OFF. And I think it is OFF by default. Then there is no need to fiddle with environment variables or adding anything to PATH. – Dženan Jul 28 '17 at 13:50
  • If you used cmake-gui's built-in path browser, it would have written the path with forward slashes into your edit field (and later into the file). Even if you copy-paste the path with backslashes, CMake offers auto-completed path with forwards slashes. I hope this will make your life easier in the future. – Dženan Jul 28 '17 at 13:52

1 Answers1

1

The issue went back to the VTK_DIR which was defined by "\". First, I tried to replace all "\" in my environment variable VTK_DIR with "/" but it resulted in the same error. Then I defined VTK_DIR as an Entry in CMake and a path with "/" was dedicated, again the same error. In fact the problem was due to the ITKVtkGlue.cmake. The VTK_DIR was set by "\" and I manually replaced them by "/", and now ITK+VTK goes well...

ir0098
  • 127
  • 1
  • 13