[CMake] Trouble setting LIBRARY_OUTPUT_DIRECTORY

Lober, Randy rrlober at sandia.gov
Thu Jun 4 16:10:01 EDT 2009


Thanks for the response and suggestion Mike.

I had tried directly setting the value CMAKE_LIBRARY_OUTPUT_DIRECTORY once before to no avail but following your idea I tried all three again as you list below. Unfortunately, this still does not succeed in defining a non-default creation location for my targets. Again, even using the commands below no values for the three variables are being written into my CMakeCache.txt file.

I have changed the rest of my operations in the file to work with the targets from the default location but it is troubling to me that this command (seemingly) is not working for me. I will be moving on to much more difficult builds soon and I will need this functionality.

If anyone has any other insights I would greatly appreciate them.

Thanks, Randy


On 6/4/09 1:22 PM, "Michael Jackson" <mike.jackson at bluequartz.net> wrote:

# ---------- Setup output Directories -------------------------
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
   ${PROJECT_BINARY_DIR}/Bin )

# --------- Setup the Executable output Directory -------------
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
   ${PROJECT_BINARY_DIR}/Bin )

# --------- Setup the Executable output Directory -------------
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
   ${PROJECT_BINARY_DIR}/Bin )

Will put every library and executable into a subdirectory called "Bin"

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Jun 4, 2009, at 3:13 PM, Lober, Randy wrote:

> Hello, I am a new user of cmake and I am running version 2.6-patch 4
> on Linux.
>
> I am setting up a simple project to learn cmake and most everything
> has worked just as expected except for my attempts to define where
> an output library target is to be created. Here is part of the
> CMakeLists.txt
>
> project(ZLIB C)
> SET(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/install)
> SET(CMAKE_BUILD_TYPE Release)
>
> set(CMAKE_C_COMPILER gcc)
> add_definitions(-O3)
> set(BUILD_SHARED_LIBS ON)
> cmake_minimum_required(VERSION 2.6)
>
> set(ZLIB_PUBLIC_HDRS
>     zconf.h
>     zlib.h
> )
>
> set(ZLIB_PRIVATE_HDRS
>     crc32.h
>     deflate.h
>     inffast.h
>     inffixed.h
>     inflate.h
>     inftrees.h
>     trees.h
>     zutil.h
> )
>
> set(ZLIB_SRCS
>     adler32.c
>     compress.c
>     crc32.c
>     deflate.c
>     inflate.c
>     infback.c
>     inftrees.c
>     inffast.c
>     gzio.c
>     trees.c
>     uncompr.c
>     zutil.c
> )
>
> set(ZLIB_TEST_SRCS
>     example.c
> )
>
> set(ZLIB_MAN_SRCS
>     zlib.3
> )
>
> add_library(z ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
> set_target_properties(z PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
> set(LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
>
> add_executable(example ${ZLIB_TEST_SRCS})
> set(RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
>
> add_dependencies(example z)
>
> target_link_libraries(example z)
>
> install(TARGETS z DESTINATION lib )
> install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION include)
> install(TARGETS example DESTINATION bin)
> install(FILES ${ZLIB_MAN_SRCS} DESTINATION share/man/man3)
>
> I have tried many variations of setting the location for the target
> z to be created (and the executable "example"), both the new style
> as shown above and the old style (LIBRARY_OUTPUT_PATH), using
> variables as above and using absolute paths and nothing works.
> libz.so is always dropped directly into my build directory.
>
> Interesting, if I hand edit the cache file and add the variable
> CMAKE_LIBRARY_OUTPUT_DIRECTORY to change the library creation
> location it works: why does my cmake configuration not respect the
> above commands and write this into the cache file automatically?
>
> Thanks,
>
> --Randy
>
> +
> ---------------------------------------------------------------------+
> |Randy R. Lober                Email:
> rrlober at sandia.gov              |
> |Sandia National Laboratories  Systems Engineering, Integration &
> Test|
> |P.O. Box 5800, MS
> 0835                                               |
> |Albuquerque, NM 87185-0835    (505) 845-9353 FAX
> 284-1242            |
> +
> ---------------------------------------------------------------------+
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



Regards,

--Randy

+---------------------------------------------------------------------+
|Randy R. Lober                Email: rrlober at sandia.gov              |
|Sandia National Laboratories  Systems Engineering, Integration & Test|
|P.O. Box 5800, MS 0835                                               |
|Albuquerque, NM 87185-0835    (505) 845-9353 FAX 284-1242            |
+---------------------------------------------------------------------+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090604/90069d32/attachment-0001.htm>


More information about the CMake mailing list