[CMake] Trouble setting LIBRARY_OUTPUT_DIRECTORY
Michael Jackson
mike.jackson at bluequartz.net
Thu Jun 4 15:22:06 EDT 2009
# ---------- 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
More information about the CMake
mailing list