lundi 23 juillet 2018

Writing a makefile using cmake

I have a directory structure as shown below:

HP_detectnet
-CMakeLists.txt
-include
        -cudaFont.h cudaMappedMemory.h cudaNormalize.h cudaUtility.h 
-detectnet-camera
                 -include
                         -Ndetectnet.h
                 -src
                      -Ndetectnet-camera.cpp
                 -CMakeLists.txt

I have added following code to the toplevel CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
project (HPdetectnet)

# The version number.
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wall")
set_target_properties(detectnet_camera PROPERTIES LINKER_LANGUAGE CXX)

#There are lots of scripts with cmake
#for finding external libraries. 
#see /usr/local/share/cmake-2.6/Modules/Find*.cmake for more examples
find_package(GLUT REQUIRED)
find_package(OpenGL REQUIRED)

target_include_directories(detectnet_camera_main /include)
add_subdirectory(detectnet_camera)

and below code to CMakeLists.txt inside detectnet-camera directory:

cmake_minimum_required(VERSION 2.6)

set_target_properties(detectnet_camera PROPERTIES LINKER_LANGUAGE CXX)

add_executable(detectnet_camera Ndetectnet_camera.cpp) target_link_libraries(detectnet_camera GLUT OpenGL)

while running "cmake" i get following error:

CMake Error at CMakeLists.txt:3 (set_target_properties): set_target_properties Can not find target to add properties to: detectnet_camera

-- Configuring incomplete, errors occurred!

Can someone please suggest where is it wrong???

Thanks, Nidhi Arora

Aucun commentaire:

Enregistrer un commentaire