[CMake] Help with INSTALL(TARGETS

Michael Salt Michael.Salt at student.manchester.ac.uk
Mon Jun 9 10:46:55 EDT 2008


Hello All,

This is my first cmake post, please be gentle.

I have a cmake project that consists of a top level, and then three  
sublevels which contain the individual projects. At this moment,  
compilation happens without fault, but runtime fails due to DLLs not  
being in the correct place.

What I would like to do is to put the output (.exe/.dll) into the bin  
directory. Here are some details to help you to visualise the layout...

C:\GPMAD (top-level directory)

C:\GPMAD\CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

project(GPMADv01)

add_subdirectory(gmadParser)
add_subdirectory(CUDA)
add_subdirectory(src)

INSTALL(TARGETS coreGPU PARSER GPMAD
   RUNTIME DESTINATION bin
   LIBRARY DESTINATION lib
)

Then I have three subdirectories, for example:
C:\GPMAD\src\

Which contains C:\GPMAD\src\CMakeList.txt:
include_directories(${GPMADv01_SOURCE_DIR}/gmadParser)

link_directories(${GPMADv01_BINARY_DIR}/gmadParser)

add_executable(GPMAD main.cpp dipole.cpp drift.cpp edgeenter.cpp  
edgeexit.cpp kicker.cpp quadrupole.cpp sextupole.cpp rcol.cpp  
collimation.cpp ecol.cpp)

add_dependencies(GPMAD parser coreGPU)

target_link_libraries(GPMAD PARSER)

There are two other directories, gmadParser and CUDA, each containing  
an add_libraries() command.

When I generate a Visual Studio 9 project, I get the following error  
message...
"CMake Error at CMakeLists.txt:9 (INSTALL):
   install TARGETS given target "coreGPU" which does not exist in this  
directory."

I do not yet understand enough to determine what is wrong here. Any  
input is greatly appreciated.

Thanks,

Mike


More information about the CMake mailing list