Discussion:
[CMake] Help with INSTALL(TARGETS
Michael Salt
2008-06-09 14:46:55 UTC
Permalink
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
Alexander Neundorf
2008-06-09 18:37:46 UTC
Permalink
Post by Michael Salt
Hello All,
...
Post by Michael Salt
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...
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.
Without actually checking...
I would suggest to put the INSTALL(TARGETS ...) commands in the CMakeLists.txt
where the actual targets are created. That's also what the error message
says. It should work then.

Alex
Michael Salt
2008-06-10 08:27:36 UTC
Permalink
Thanks Alex,

The trouble is that at the moment, my targets (.exe, .dll) are built
in a directory within the 'build' folder. Of course, the contents of
the build folder are not generated until I run cmake, so I actually
have nowhere to put the CMakeLists.txt file. I do not want to create
the folders manually because it may just be a Visual Studio specific
feature to create executables within the subdirectories of the build
folder, and I wish to retain portability.

Is it possible that I am doing something awkward that makes this
feature difficult to use?

Cheers,

Mike
Post by Alexander Neundorf
Post by Michael Salt
Hello All,
...
Post by Michael Salt
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...
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.
Without actually checking...
I would suggest to put the INSTALL(TARGETS ...) commands in the CMakeLists.txt
where the actual targets are created. That's also what the error message
says. It should work then.
Alex
_______________________________________________
CMake mailing list
http://www.cmake.org/mailman/listinfo/cmake
Alexander Neundorf
2008-06-10 18:55:08 UTC
Permalink
Post by Michael Salt
Thanks Alex,
The trouble is that at the moment, my targets (.exe, .dll) are built
in a directory within the 'build' folder. Of course, the contents of
the build folder are not generated until I run cmake, so I actually
have nowhere to put the CMakeLists.txt file. I do not want to create
I don't understand.
The CMakeLists.txt should be on the source dir.
Can you please explain ?

Alex
Michael Salt
2008-06-10 19:46:34 UTC
Permalink
It is alright now Alex. When I put the INSTALL paths in the actual
directories themselves, rather than the top directory, it all worked
fine. It put the executable in 'Program Files' which I really did not
expect, and missed it.

Basically, I had the main directory, GPMAD, and three subdirectories.
Each of the subdirectories is an individual project, one an
executable, the other two libraries to which the executable refers.

The complication is that I am trying to use cmake with the nVidia CUDA
programming language. I have a cmake script from MIT, but it is a
whole bunch of fun. When I get the last of it sorted, I shall post for
all to refer to.

Thank you,

Mike
Post by Alexander Neundorf
Post by Michael Salt
Thanks Alex,
The trouble is that at the moment, my targets (.exe, .dll) are built
in a directory within the 'build' folder. Of course, the contents of
the build folder are not generated until I run cmake, so I actually
have nowhere to put the CMakeLists.txt file. I do not want to create
I don't understand.
The CMakeLists.txt should be on the source dir.
Can you please explain ?
Alex
_______________________________________________
CMake mailing list
http://www.cmake.org/mailman/listinfo/cmake
Continue reading on narkive:
Loading...