Hello there,
I have already posted for help on Reddit (here), but I believe I might get more insightful help here.
My environment: Windows 10, latest MSYS2/MinGW64, CMake 3.20.2, Intel IPP 2021.2.0
My objective: include IPP libraries for use in my project.
My issue: when using find_package
with Intel-provided ipp-config.cmake
, some variables are set while others aren’t, even though they should.
I have installed Intel IPP using the official installer, which includes a CMake package config file in C:\Program Files (x86)\Intel\oneAPI\ipp\2021.2.0\lib\cmake\ipp\ipp-config.cmake
. You can find its paste here: pastebin .com/j3r67M1N
This is my CMakeLists.txt
:
cmake_minimum_required(VERSION 3.20)
project(MyProject)
find_package(IPP REQUIRED)
message("${IPP_FOUND} | ${IPP_SHARED} | ${IPP_ARCH} | ${IPP_TL_VARIANT} | ${IPP_LIBRARIES} | ${WIN32} | ${IPP_ippcore_FOUND}")
add_executable(MyExec src/main.cpp)
target_link_libraries(MyExec ${IPP_LIBRARIES})
This is the output in a MinGW64 bash shell:
$ /c/Program\ Files/CMake/bin/cmake.exe .. -G "MinGW Makefiles"
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
1 | | intel64 | OpenMP | | 1 |
-- Configuring done
-- Generating done
-- Build files have been written to: C:/REDACTED/build
Minor doubt: how does CMake know to use ipp-config.cmake
when there is neither a built-in nor user-provided FindIPP? All I can see is an environment variable called ONEAPI_ROOT
, which points to C:\Program Files (x86)\Intel\oneAPI
; is this enough for CMake to do its thing?
Actual issue: take a look at the output of the message()
command; as you can see IPP_FOUND
, IPP_ARCH
and IPP_TL_VARIANT
are correctly set as expected (to their defaults), while IPP_LIBRARIES
and IPP_ippcore_FOUND
aren’t.
I can confidently say that they are being set by IPP’s config, because when I added a variable_watch(IPP_LIBRARIES)
, this was the output (full paste here: pastebin .com/gz2V5Ajh ), includes also a set(IPP_LIBRARIES "WTF")
to make the issue more evident):
CMake Debug Log at C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/cmake/ipp/ipp-config.cmake:128 (list):
Variable "IPP_LIBRARIES" was accessed using MODIFIED_ACCESS with value
"IPP::ipp_iw".
...
CMake Debug Log at C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/cmake/ipp/ipp-config.cmake:128 (list):
Variable "IPP_LIBRARIES" was accessed using READ_ACCESS with value "".
...
CMake Debug Log at C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/cmake/ipp/ipp-config.cmake:128 (list):
Variable "IPP_LIBRARIES" was accessed using MODIFIED_ACCESS with value
"IPP::ippcore".
I then tried with target_link_libraries(MyExec IPP::ippcore)
and guess what, that worked. But IPP_LIBRARIES
is still empty. What the hell?
Does anyone have any clue why the list(APPEND IPP_LIBRARIES ...)
in IPP’s config is always appending to an empty/reset variable?
Thanks in advance