Issue regarding CMake Error: No source given to target - c++

I am trying to add FreeRtos to a project of mine using cmake and eclipse but I am getting an error. I am running debian 10 and my cmake version is 3.13.4. The files for cmake can be found at this git repo. When I run the following command:
frank#debian:~/temp2/build$ cmake ../../temp2/AM335X-FreeRTOS-lwip/ -G"Eclipse CDT4 - Unix Makefiles"
I get the following error:
CMake Error at ProjectIncludes.cmake:46 (add_library):
No SOURCES given to target: lib_third_party_ti_platform_beaglebone
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:30 (add_library):
No SOURCES given to target: lib_third_party_ti_utils
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:38 (add_library):
No SOURCES given to target: lib_third_party_ti_mmcsdlib
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:54 (add_library):
No SOURCES given to target: lib_third_party_ti_nandlib
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at CMakeLists.txt:15 (add_executable):
No SOURCES given to target: freeRTOSBBB.elf
CMake Error at ProjectIncludes.cmake:23 (add_library):
No SOURCES given to target: lib_third_party_ti_drivers
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:115 (add_library):
No SOURCES given to target:
lib_third_party_amazon_freertos_kernel_portable_MemMang
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:86 (add_library):
No SOURCES given to target:
lib_third_party_amazon_libraries_3rdparty_lwip_src
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:101 (add_library):
No SOURCES given to target: src_portable_lwip_ports_cpsw_netif
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:106 (add_library):
No SOURCES given to target: lib_third_party_amazon_freertos_kernel
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:111 (add_library):
No SOURCES given to target:
src_portable_FreeRTOS_portable_GCC_ARM_CA8_amm335x
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:65 (add_library):
No SOURCES given to target: lib_third_party_ti_system_config_armv7a
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:134 (add_library):
No SOURCES given to target: src_application
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:120 (add_library):
No SOURCES given to target: src_portable_AM335X
Call Stack (most recent call first):
CMakeLists.txt:33 (include)
CMake Error at ProjectIncludes.cmake:129 (add_library):
No SOURCES given to target: src_portable_ported_aws_bufpool
Call Stack (most recent call first):
CMakeLists.txt:33 (include)

The error says what it means: there are no sources for libraries.
#adding entries for lib_third_party_ti_mmcsdlib
include_directories("${PROJECT_SOURCE_DIR}/lib/third_party/ti/mmcsdlib")
include_directories("${PROJECT_SOURCE_DIR}/lib/third_party/ti/mmcsdlib/include")
add_library(lib_third_party_ti_mmcsdlib "") # NO SOURCES HERE!!!!
target_compile_definitions(lib_third_party_ti_mmcsdlib
PRIVATE -DBOOT=MMCSD -DCONSOLE=UARTCONSOLE
)
subdirs("${PROJECT_SOURCE_DIR}/lib/third_party/ti/mmcsdlib")
subdirs("${PROJECT_SOURCE_DIR}/lib/third_party/ti/mmcsdlib/include")
You should read the docs about add_library in cmake. If you don't provide any source files, you should declare it as INTERFACE
add_library(LibName INTERFACE)
In this case no compilation target would be generated.
Otherwise, you can declare it as IMPORTED, then cmake will not try to create a target for compilation either.
For SHARED, STATIC or OBJECT you always need to supply sources.
You should check ProjectIncludes.cmake for what you really want to do: compile new libs or import them.

For me (came here from Google), this error occurred when CMake target_sources had only PRIVATE sources, and no PUBLIC sources.
I had to make at least one PUBLIC source file:
old:
target_sources(${PROJECT_NAME}
PRIVATE
External/dbscan.cpp
main.cpp
)
new:
target_sources(${PROJECT_NAME}
PRIVATE
External/dbscan.cpp
PUBLIC
main.cpp
)

Related

FindJUCE.cmake: Cannot specify sources for imported target “juce_core”

I am trying to compile the hello world program. I have used the CMakeList provided by this link: https://github.com/remymuller/juce-cmake
I don't know what these errors mean and how to solve them. Please help.
CMakeLists.txt
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(HelloWorld)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/home/sulakshana/Documents/evon/work/juce/helloworld/NewProject/juce-cmake/cmake/")
find_package(JUCE REQUIRED
COMPONENTS
juce_core
juce_data_structures
juce_events
juce_graphics
juce_gui_basics
juce_gui_extra
)
set(SOURCES
../../Source/Main.cpp
../../Source/MainComponent.h
../../Source/MainComponent.cpp
)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
target_link_libraries(${PROJECT_NAME} ${JUCE_LIBRARIES})
source_group(Source FILES ${SOURCES})
I have used this .cmake: https://github.com/remymuller/juce-cmake/blob/master/cmake/FindJUCE.cmake
Folder structure:
Here juce-cmake is the clone of the above linked repository:
$ ls
Builds juce-cmake JuceLibraryCode NewProject.jucer Source
Place of CMakeLists.txt:
/Builds/LinuxMakefile$ ls
build buildCMake CMakeLists.txt Makefile
Errors:
$ cmake ..
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:344 (target_sources):
Cannot specify sources for imported target "juce_core".
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:490 (juce_add_module)
CMakeLists.txt:7 (find_package)
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:344 (target_sources):
Cannot specify sources for imported target "juce_data_structures".
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:490 (juce_add_module)
CMakeLists.txt:7 (find_package)
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:344 (target_sources):
Cannot specify sources for imported target "juce_events".
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:363 (juce_add_module)
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:490 (juce_add_module)
CMakeLists.txt:7 (find_package)
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:344 (target_sources):
Cannot specify sources for imported target "juce_graphics".
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:490 (juce_add_module)
CMakeLists.txt:7 (find_package)
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:344 (target_sources):
Cannot specify sources for imported target "juce_gui_basics".
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:490 (juce_add_module)
CMakeLists.txt:7 (find_package)
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:344 (target_sources):
Cannot specify sources for imported target "juce_gui_extra".
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:490 (juce_add_module)
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/AppConfig.h.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:264 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:501 (juce_generate_app_config)
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/JuceHeader.h.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:283 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:514 (juce_generate_juce_header)
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/include_juce_module.cpp.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:566 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/include_juce_module.cpp.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:566 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/include_juce_module.cpp.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:566 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/include_juce_module.cpp.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:566 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/include_juce_module.cpp.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:566 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
CMake Error: File /home/sulakshana/Documents/evon/work/juce/helloworld/FindJuceTemplates/include_juce_module.cpp.in does not exist.
CMake Error at /home/sulakshana/Documents/evon/work/juce/helloworld/FindJUCE.cmake:566 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/sulakshana/Documents/evon/work/juce/helloworld/NewProject/Builds/LinuxMakefile/buildCMake/CMakeFiles/CMakeOutput.log".
This module is relying on functionality that was added in CMake 3.11. Make sure you have at least that version.
The last set of errors is because you only copied the FindJUCE.cmake file but not the FindJuceTemplates directory that comes with it. I suggest cloning/downloading the entire repository into your working directory (or adding it as a Git submodule) and then including it. You may need to point CMAKE_MODULE_PATH to the subdirectory.

cmake can't find boost

My OS is Centos 7,using cmake3 3.17.3,and I use cmake to download a package.When I type
cmake3 ..
I get
CMake Error at /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR filesystem program_options
system) (Required is at least version "1.50")
Call Stack (most recent call first):
/usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake3/Modules/FindBoost.cmake:2166 (find_package_handle_standard_args)
CMakeLists.txt:20 (find_package)
However, with
rpm -qa|grep
I can find
boost-filesystem-1.53.0-28.el7.x86_64
boost-program-options-1.53.0-28.el7.i686
boost-system-1.53.0-28.el7.x86_64
So how can I solve this problem?

compiling C++ boost library for Sony NMOS implementation

I'm compiling an open source software and in the process of satisfying the required dependencies I'm getting the following errors. The source is located here.
Sony NMOS GIT Repository
The compilation errors appears to be related to C++ Boost and OpenSSL. It appears the c++ dependencies are not available. How can I compile c++ boost from source to resolve this issue? Second I will also have to compile OPENSSL and make the library available so the dependencies can be satisfied.
[root#nmos build]# cmake .. -DCMAKE_BUILD_TYPE:STRING="<Debug-or-Release>" -DWERROR:BOOL="0" -DBUILD_SAMPLES:BOOL="0" -DBUILD_TESTS:BOOL="0"
-- Setting gcc options
-- websocketpp not found, using the embedded version
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:577 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Error at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:2048 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
cmake/cpprest_find_boost.cmake:49 (find_package)
cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
CMake Error at /usr/local/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR) (Required is at least version "1.0.0")
Call Stack (most recent call first):
/usr/local/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.12/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
cmake/cpprest_find_openssl.cmake:44 (find_package)
cmake/cpprest_find_websocketpp.cmake:18 (cpprest_find_openssl)
src/CMakeLists.txt:68 (cpprest_find_websocketpp)
-- Configuring incomplete, errors occurred!
See also "/home/admin/cpprestsdk/Release/build/CMakeFiles/CMakeOutput.log".
See also "/home/admin/cpprestsdk/Release/build/CMakeFiles/CMakeError.log".
Feel free to post questions like this as issues on the sony/nmos-cpp GitHub issue tracker: https://github.com/sony/nmos-cpp/issues. Thanks!

CMake find_package with GLEW

I am trying to set up a CMakeLists.txt file for my project which uses GLEW. I have been doing it like this:
find_path(GLEW_INCLUDE_DIR GL/glew.h)
find_library(GLEW_LIBRARY_RELEASE glew32)
find_library(GLEW_LIBRARY_DEBUG glew32d)
target_include_directories(${APP_NAME} PUBLIC ${GLEW_INCLUDE_DIR})
target_link_libraries(${APP_NAME} optimized ${GLEW_LIBRARY_RELEASE}
debug ${GLEW_LIBRARY_DEBUG})
This approach works but I want to use the find_package approach because I think it is better.
I have found some examples on this site like this one: Adding GLEW to project (CMake) which suggests doing something like this:
find_package(GLEW REQUIRED)
target_link_libraries(${APP_NAME} GLEW::GLEW)
But when I try to to do this, it produces errors during the configuration phase:
CMake Error at C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:16 (include):
include could not find load file:
C:/libs/glew-2.1.0/build/cmake/glew-targets.cmake
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:64 (get_property):
get_property could not find TARGET GLEW::glew. Perhaps it has not yet been
created.
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
CMake Error at C:/libs/glew-2.1.0/build/cmake/CopyImportedTargetProperties.cmake:73 (get_target_property):
get_target_property() called with non-existent target "GLEW::glew".
Call Stack (most recent call first):
C:/libs/glew-2.1.0/build/cmake/glew-config.cmake:56 (copy_imported_target_properties)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindGLEW.cmake:62 (find_package)
CMakeLists.txt:14 (find_package)
So it looks like it is looking for glew-targets.cmake in C:/libs/glew-2.1.0/build/cmake which is the GLEW_DIR I set in CMake GUI because it has the glew-config.cmake file.
But the glew-targets.cmake file is actually in C:\libs\glew-2.1.0\build\cmake\build\CMakeFiles\Export\lib\cmake\glew where it got created when I ran CMake on GLEW.
Why is it looking in the wrong place?
I downloaded GLEW as a .ZIP source from http://glew.sourceforge.net/. I then ran CMake on it while specifying C:/libs/glew-2.1.0/build/cmake as the source directory and C:/libs/glew-2.1.0/build/cmake/build as the build directory.
So how exactly I am supposed to do this?
This approach works but I want to use the find_package approach because I think it is better.
It is better, since you cannot know all the requirements glew needs in order to be used. The find_package command has all the necessary to detect requirements from supported libraries (or libraries that support CMake).
So it looks like it is looking for glew-targets.cmake in C:/libs/glew-2.1.0/build/cmake which is the GLEW_DIR I set in CMake GUI because it has the glew-config.cmake file.
The thing is GLEW don't support importing from it's build tree.
To make it work, simply set a install prefix when building GLEW with CMake:
-DCMAKE_INSTALL_PREFIX=C:/libs/glew-2.1.0/build/cmake/install
Then, install the library. It should install in the specified directory.
Then, you should set the glew_DIR variable to that directory:
set(glew_DIR "C:/libs/glew-2.1.0/build/cmake/install/lib/cmake/glew")
You can alternatively set the prefix path to the installation directory:
list(APPEND CMAKE_PREFIX_PATH "C:/libs/glew-2.1.0/build/cmake/install")
It finds the wrong file because inside their source directory, glew has a file named glew-config.cmake (IMO it should be in a subfolder to avoid situation like this one).
The build directory should also contain the config file.

CMake Unable to find Boost Libraries (System, Thread, Filesystem)

I'm trying to install and use DeepLab for a segmentation project, but when trying to configure this using CMake it is unable to find boost libraries, despite identifying boost's version and location. I've tried following advice in similar questions by manually specifying locations but still encounter the same issue. Error messages attached below. Any idea what could be causing this issue?
Thanks in advance.
CMake Error at E:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1956 (message):
Unable to find the requested Boost libraries.
Boost version: 1.65.0
Boost include path: C:/local/boost_1_65_0
Could not find the following Boost libraries:
boost_system
boost_thread
boost_filesystem
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
cmake/Dependencies.cmake:5 (find_package)
CMakeLists.txt:50 (include)
Found gflags (include: C:/Program Files/gflags/include, library: optimized;C:/Program Files/gflags/lib;debug;C:/Program Files/gflags/lib)
Found glog (include: C:/Program Files/glog/include, library: optimized;C:/Program Files/glog/lib;debug;C:/Program Files/glog/lib)
CMake Error at E:/Program Files/CMake/share/cmake-3.10/Modules/FindProtobuf.cmake:425 (file):
file STRINGS file
"C:/Users/Benn/.caffe/dependencies/libraries_v140_x64_py27_1.1.0/libraries/include/google/protobuf/google/protobuf/stubs/common.h"
cannot be read.
Call Stack (most recent call first):
cmake/ProtoBuf.cmake:4 (find_package)
cmake/Dependencies.cmake:24 (include)
CMakeLists.txt:50 (include)
CMake Error at E:/Program Files/CMake/share/cmake-3.10/Modules/FindProtobuf.cmake:431 (math):
math cannot parse the expression: " / 1000000": syntax error, unexpected
exp_DIVIDE, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER
(2)
Call Stack (most recent call first):
cmake/ProtoBuf.cmake:4 (find_package)
cmake/Dependencies.cmake:24 (include)
CMakeLists.txt:50 (include)
CMake Error at E:/Program Files/CMake/share/cmake-3.10/Modules/FindProtobuf.cmake:432 (math):
math cannot parse the expression: " / 1000 % 1000": syntax error,
unexpected exp_DIVIDE, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or
exp_NUMBER (2)
Call Stack (most recent call first):
cmake/ProtoBuf.cmake:4 (find_package)
cmake/Dependencies.cmake:24 (include)
CMakeLists.txt:50 (include)
CMake Error at E:/Program Files/CMake/share/cmake-3.10/Modules/FindProtobuf.cmake:433 (math):
math cannot parse the expression: " % 1000": syntax error, unexpected
exp_MOD, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER
(2)
Call Stack (most recent call first):
cmake/ProtoBuf.cmake:4 (find_package)
cmake/Dependencies.cmake:24 (include)
CMakeLists.txt:50 (include)
Found PROTOBUF Compiler: C:/Users/Benn/.caffe/dependencies/libraries_v140_x64_py27_1.1.0/libraries/include/google/protobuf
CMake Error at cmake/ProtoBuf.cmake:19 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
Call Stack (most recent call first):
cmake/Dependencies.cmake:24 (include)
CMakeLists.txt:50 (include)
CMake Error at E:/Program Files/CMake/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS
HDF5_HL_LIBRARIES HL) (found version "")
Call Stack (most recent call first):
E:/Program Files/CMake/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
E:/Program Files/CMake/share/cmake-3.10/Modules/FindHDF5.cmake:905 (find_package_handle_standard_args)
cmake/Dependencies.cmake:27 (find_package)
CMakeLists.txt:50 (include)
Configuring incomplete, errors occurred!