References to tbb-NOTFOUND.obj
Opened this issue · 7 comments
When I try to use TBB with my CMake project like this:
list(APPEND CMAKE_MODULE_PATH "<path to FindTBB module>")
find_package(TBB REQUIRED)
add_executable(myapp myapp.cc)
target_link_libraries(myapp tbb)
It in the end tries to link tbb-NOTFOUND.obj
(which of course fails).
Thank you for the bug report. Can you also provide the arguments you used when you invoked cmake, OS, and compiler? So I can try to reproduce your error.
Am compiling with VS2015 on Windows 10.
In the .vcxproj
I have the following entry:
<Link>
<AdditionalOptions> /machine:x64"%3B"/NODEFAULTLIB:msvcrt.lib"%3B"/NODEFAULTLIB:libcmt.lib"%3B"/NODEFAULTLIB:libcmtd.lib %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;tbb-NOTFOUND
Not sure yet, where this comes from. Would guess find_package_handle_standard_args
.
Might be this problem here: https://stackoverflow.com/questions/14850736/cmake-imported-library-behaviour
Switched add_library
to static
and seems to work for DEBUG and RELEASE at least. RELWITHDEBINFO
cannot link tbb.lib
, though.
Yes, the SO post looks like a likely source of the error.
I will look into the error this weekend.
Problem with RELWITHDEBINFO
seems to be that there is no _DEBUG
defined and then TBB in _tbb_windef.h
and runtime_loader.h
decides to implicitly link with tbb.lib
.
Sadly only setting __TBB_LIB_NAME
does not fix the behavior. You probably have to set __TBB_NO_IMPLICIT_LINKAGE
to 1
to disable implicit linking completely.