UseVTK.cmake: file not recognized

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

UseVTK.cmake: file not recognized

rolof
Hello, I am trying to compile a source code to load a stl file. This source
is inside of a folder in my dekstop, and I have not installed vtk, I have
only built it.

My Cmake file is the next:
---------------------------------------------------------------------------------------------------------------
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 3.9.5 FATAL_ERROR)
foreach(p
    ## Only policies introduced after the cmake_minimum_required
    ## version need to explicitly be set to NEW.
    CMP0070 #3.10.0 Define ``file(GENERATE)`` behavior for relative paths.
    CMP0071 #3.10.0 Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED``
files.
    )
  if(POLICY ${p})
    cmake_policy(SET ${p} NEW)
  endif()
endforeach()


set (CMAKE_CXX_STANDARD 11)

# This project is designed to be built outside the Insight source tree.
project(HelloWorld)
# Find VTK.
set( VTK_DIR "/home/fj/src_build/VTK-8.1.0" )
FIND_PACKAGE (VTK REQUIRED)
IF(VTK_FOUND)
INCLUDE(${VTK_USE_FILE})
ENDIF(VTK_FOUND)

add_executable(loadStl load_STL_file.cpp)

target_link_libraries(loadStl ${VTK_USE_FILE})
---------------------------------------------------------------------------------------------------------------


When I try to do the "make step" I obtain the next:
---------------------------------------------------------------------------------------------------------------
[ 50%] Building CXX object CMakeFiles/loadStl.dir/load_STL_file.cpp.o
[100%] Linking CXX executable loadStl
/home/fj/src_build/VTK-8.1.0/CMake/UseVTK.cmake: file not recognized:
collect2: error: ld returned 1 exit status
....
---------------------------------------------------------------------------------------------------------------

I do not know what I am doing wrong. Thanks in advance.





--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: UseVTK.cmake: file not recognized

mchinand
Your target_link_libraries line should use the variable ${VTK_LIBRARIES} instead of ${VTK_USE_FILE}.

On Thu, Jun 7, 2018 at 4:20 AM rolof <[hidden email]> wrote:
Hello, I am trying to compile a source code to load a stl file. This source
is inside of a folder in my dekstop, and I have not installed vtk, I have
only built it.

My Cmake file is the next:
---------------------------------------------------------------------------------------------------------------
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 3.9.5 FATAL_ERROR)
foreach(p
    ## Only policies introduced after the cmake_minimum_required
    ## version need to explicitly be set to NEW.
    CMP0070 #3.10.0 Define ``file(GENERATE)`` behavior for relative paths.
    CMP0071 #3.10.0 Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED``
files.
    )
  if(POLICY ${p})
    cmake_policy(SET ${p} NEW)
  endif()
endforeach()


set (CMAKE_CXX_STANDARD 11)

# This project is designed to be built outside the Insight source tree.
project(HelloWorld)
# Find VTK.
set( VTK_DIR "/home/fj/src_build/VTK-8.1.0" )
FIND_PACKAGE (VTK REQUIRED)
IF(VTK_FOUND)
INCLUDE(${VTK_USE_FILE})
ENDIF(VTK_FOUND)

add_executable(loadStl load_STL_file.cpp)

target_link_libraries(loadStl ${VTK_USE_FILE})
---------------------------------------------------------------------------------------------------------------


When I try to do the "make step" I obtain the next:
---------------------------------------------------------------------------------------------------------------
[ 50%] Building CXX object CMakeFiles/loadStl.dir/load_STL_file.cpp.o
[100%] Linking CXX executable loadStl
/home/fj/src_build/VTK-8.1.0/CMake/UseVTK.cmake: file not recognized:
collect2: error: ld returned 1 exit status
....
---------------------------------------------------------------------------------------------------------------

I do not know what I am doing wrong. Thanks in advance.





--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: UseVTK.cmake: file not recognized

rolof
Thank you I didn't notice that I was using a ${VTK_USE_FILE} instead of
${VTK_LIBRARIES}.

Thank you again.



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers