[CMake] need two compilation to achieve success
Michael Jackson
mike.jackson at bluequartz.net
Wed Jun 3 15:25:15 EDT 2009
On Jun 3, 2009, at 2:53 PM, eial at cs.bgu.ac.il wrote:
>
> TARGET_LINK_LIBRARIES(AgathaHud libAgathaUtils libAgathaEngine
> libAgathaThreads)
> the error output is: /usr/lib/gcc/x86_64-pc-linux-gnu/
> 4.3.3/../../../../x86_64-pc-linux-gnu/bin/ld:
> cannot find -llibAgathaUtils
>
> like I've said before, the libs are generated into the bin/libs
> folder and the actual program binary
> is created at bin
Subtle..
You need something like:
link_directories (${PROJECT_BINARY_DIR}/bin/lib )
Assuming you only have one call to "project()"
If you are dumping libraries into bin/libs then I would set the
following variables near the top of the top most cmakelists.txt file,
just after the first call to "project"
# ---------- Setup output Directories -------------------------
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin/libs
CACHE PATH
"Single Directory for all Libraries"
)
# --------- Setup the Executable output Directory -------------
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin
CACHE PATH
"Single Directory for all Executables."
)
# --------- Setup the Executable output Directory -------------
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin/libs
CACHE PATH
"Single Directory for all static libraries."
)
then you can use those variables in your other sub projects if needed:
link_libraries(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
HTH.
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
More information about the CMake
mailing list