<pre style="word-wrap: break-word; white-space: pre-wrap;">Hallo.
I try to use get_prerequisites() and it seems that it is called before the target is created. The CMake code snipped is as follows:
set(SRC_FILES ....)
# Make lib
add_library( OUTPUT SHARED ${SRCS_FILES})
target_link_libraries(OUTPUT ${PROJECT_LIBRARIES})
target_link_libraries(OUTPUT ${PYTHON_LIBRARIES})
# Install
install(TARGETS OUTPUT RUNTIME DESTINATION ./ COMPONENT Runtime
LIBRARY DESTINATION ./ COMPONENT Runtime)
# ---
include(GetPrerequisites)
string(TOUPPER ${CMAKE_BUILD_TYPE} CONFIG)
get_target_property(LOC OUTPUT LOCATION_${CONFIG})
##
message("---> location = ${LOC}")
##
get_prerequisites(${LOC} PREREQS 0 0 "" "")
##
message("---> prerequisites: ${PREREQS}")
foreach(D ${PREREQS})
message(" ---> ${D}")
endforeach()
###
but it seems that get_prerequisites() is called before the target is created (the sources are compiled and library is linked). It results in the following error messages.
Under Linux:
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
...
CMake Warning (dev) at CMakeLists.txt:171 (get_target_property):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The LOCATION property should not be read from target
"SpeechTechTTS_Python". Use the target name directly with
add_custom_command, or use the generator expression $<TARGET_FILE>, as
appropriate.
This warning is for project developers. Use -Wno-dev to suppress it.
---> location = /tmp/smazat_2/SpeechTechTTS_Python.so
warning: target '/tmp/smazat_2/SpeechTechTTS_Python.so' does not exist...
ldd: /tmp/smazat_2/SpeechTechTTS_Python.so: No such file or directory
---> prerequisites:
-- Configuring done
-- Generating done
Under windows:
-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
...
CMake Warning (dev) at CMakeLists.txt:171 (get_target_property):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The LOCATION property should not be read from target
"SpeechTechTTS_Python". Use the target name directly with
add_custom_command, or use the generator expression $<TARGET_FILE>, as
appropriate.
This warning is for project developers. Use -Wno-dev to suppress it.
---> location = T:/smazat/SpeechTechTTS_Python.dll
warning: target 'T:/smazat/SpeechTechTTS_Python.dll' does not exist...
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/GetPrerequisites.cmake:798 (message):
C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/dumpbin.exe
failed: 1181
-- Configuring incomplete, errors occurred!
See also "T:/smazat/CMakeFiles/CMakeOutput.log".
Microsoft (R) COFF/PE Dumper Version 12.00.40629.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file T:/smazat/SpeechTechTTS_Python.dll
LINK : fatal error LNK1181: cannot open input file
'T:/smazat/SpeechTechTTS_Python.dll'
Call Stack (most recent call first):
CMakeLists.txt:174 (get_prerequisites)
When get_prerequisites() is not called, the build works correctly. So, did I do anything wrong?
Thank you very much. Best regards,
Dan T.
P.S. I use cmake 3.0.2 under Linux and 3.4.0-rc2 on windows.</pre>