<HTML>
<HEAD>
<TITLE>Trouble setting LIBRARY_OUTPUT_DIRECTORY</TITLE>
</HEAD>
<BODY>
<FONT FACE="Courier, Courier New"><SPAN STYLE='font-size:12pt'>Hello, I am a new user of cmake and I am running version 2.6-patch 4 on Linux.<BR>
<BR>
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<BR>
<BR>
project(ZLIB C)<BR>
SET(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/install)<BR>
SET(CMAKE_BUILD_TYPE Release)<BR>
<BR>
set(CMAKE_C_COMPILER gcc)<BR>
add_definitions(-O3)<BR>
set(BUILD_SHARED_LIBS ON)<BR>
cmake_minimum_required(VERSION 2.6)<BR>
<BR>
set(ZLIB_PUBLIC_HDRS<BR>
zconf.h<BR>
zlib.h<BR>
)<BR>
<BR>
set(ZLIB_PRIVATE_HDRS<BR>
crc32.h<BR>
deflate.h<BR>
inffast.h<BR>
inffixed.h<BR>
inflate.h<BR>
inftrees.h<BR>
trees.h<BR>
zutil.h<BR>
)<BR>
<BR>
set(ZLIB_SRCS<BR>
adler32.c<BR>
compress.c<BR>
crc32.c<BR>
deflate.c<BR>
inflate.c<BR>
infback.c<BR>
inftrees.c<BR>
inffast.c<BR>
gzio.c<BR>
trees.c<BR>
uncompr.c<BR>
zutil.c<BR>
)<BR>
<BR>
set(ZLIB_TEST_SRCS<BR>
example.c<BR>
)<BR>
<BR>
set(ZLIB_MAN_SRCS<BR>
zlib.3<BR>
)<BR>
<BR>
add_library(z ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})<BR>
set_target_properties(z PROPERTIES DEFINE_SYMBOL ZLIB_DLL)<BR>
set(LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)<BR>
<BR>
add_executable(example ${ZLIB_TEST_SRCS})<BR>
set(RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)<BR>
<BR>
add_dependencies(example z)<BR>
<BR>
target_link_libraries(example z)<BR>
<BR>
install(TARGETS z DESTINATION lib )<BR>
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION include)<BR>
install(TARGETS example DESTINATION bin)<BR>
install(FILES ${ZLIB_MAN_SRCS} DESTINATION share/man/man3)<BR>
<BR>
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.<BR>
<BR>
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?<BR>
<BR>
Thanks,<BR>
<BR>
--Randy<BR>
<BR>
+---------------------------------------------------------------------+<BR>
|Randy R. Lober Email: <a href="rrlober@sandia.gov">rrlober@sandia.gov</a> |<BR>
|Sandia National Laboratories Systems Engineering, Integration & Test| <BR>
|P.O. Box 5800, MS 0835 |<BR>
|Albuquerque, NM 87185-0835 (505) 845-9353 FAX 284-1242 |<BR>
+---------------------------------------------------------------------+<BR>
</SPAN></FONT>
</BODY>
</HTML>