Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CMake ${OpenCV_LIBS} corrupted

A simple CMake project produces corrupted libraries for linking. CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)
PROJECT(bugTester CXX)

FIND_PACKAGE(OpenCV REQUIRED)
message("OpenCV_LIBS=${OpenCV_LIBS}")

ADD_EXECUTABLE(bugTester bugTester.cpp)
TARGET_LINK_LIBRARIES(bugTester ${OpenCV_LIBS})

When trying to generate the project files, I get this:

CMake Warning (dev) at CMakeLists.txt:7 (ADD_EXECUTABLE):
  Policy CMP0008 is not set: Libraries linked by full-path must have a valid
  library file name.  Run "cmake --help-policy CMP0008" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "bugTester" links to item

    C:/Program

  which is a full-path but not a valid library file name.
This warning is for project developers.  Use -Wno-dev to suppress it.

Generating done

The offending "C:/Program" can be easily tracked down to contents of ${OpenCV_LIBS} variable. Besides normal stuff, it also contains these:

C:/Program;
Files/NVIDIA;
GPU;
Computing;
Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
Toolkit/CUDA/v5.0/lib/x64/npp.lib;
Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

and those should be:

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/npp.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

It is obvious that spaces in library paths were incorrectly used to break libarary names.

Is there some fix or workaround for this? Would completely removing GPU modules from OpenCV configuration solve this?

CMake ${OpenCV_LIBS} corrupted

A simple CMake project produces corrupted libraries for linking. CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)
PROJECT(bugTester CXX)

FIND_PACKAGE(OpenCV REQUIRED)
message("OpenCV_LIBS=${OpenCV_LIBS}")

ADD_EXECUTABLE(bugTester bugTester.cpp)
TARGET_LINK_LIBRARIES(bugTester ${OpenCV_LIBS})

When trying to generate the project files, I get this:

CMake Warning (dev) at CMakeLists.txt:7 (ADD_EXECUTABLE):
  Policy CMP0008 is not set: Libraries linked by full-path must have a valid
  library file name.  Run "cmake --help-policy CMP0008" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "bugTester" links to item

    C:/Program

  which is a full-path but not a valid library file name.
This warning is for project developers.  Use -Wno-dev to suppress it.

Generating done

The offending "C:/Program" can be easily tracked down to contents of ${OpenCV_LIBS} variable. Besides normal stuff, it also contains these:

C:/Program;
Files/NVIDIA;
GPU;
Computing;
Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
Toolkit/CUDA/v5.0/lib/x64/npp.lib;
Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

and those should be:

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/npp.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

It is obvious that spaces in library paths were incorrectly used to break libarary names.

Is there some fix or workaround for this? Would completely removing GPU modules from OpenCV configuration solve this?