Hello everyone!
First, I need to thank you all the CMake developers for their awesome
work!!!
I try to build a static and a shared libraries. I set the
LIBRARY_OUTPUT_DIRECTORY for each library target like this:
set_target_properties(${sharedLib} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE})
set_target_properties(${staticLib} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE})
The shared library is built in the correct directory but the static is
built in PROJECT_BINARY_DIR.
I try to switch the order of the set_target_properties method but no
changes.
I don't why it doesn't work.
Did anyone have any ideas?
I attached my CMakeLists.txt file.
Thanks,
Romain
PS: I'm on Ubuntu 11.10 64bits, with cmake 2.8.5 (installed from the deb
package).
cmake_minimum_required(VERSION 2.8)
project(XmlParser)
find_package(CxxTest)
IF(CYGWIN)
unset(WIN32)
ENDIF()
# The version number
set(XmlParser_VERSION_MAJOR 1)
set(XmlParser_VERSION_MINOR 0)
set(XmlParser_VERSION_REVISION b)
set(XmlParser_VERSION
"${XmlParser_VERSION_MAJOR}.${XmlParser_VERSION_MINOR}${XmlParser_VERSION_REVISION}")
# configure a header file to pass some of the CMake settings
# to the source code
configure_file(
"${PROJECT_SOURCE_DIR}/include/XmlParserConfig.h.in"
"${PROJECT_BINARY_DIR}/include/XmlParserConfig.h"
)
include_directories(include ${PROJECT_BINARY_DIR}/include)
file(GLOB
SOURCE_FILES
src/*.cpp
include/template/*.hpp
)
file(GLOB
INCLUDE_FILES
include/*.h
"${PROJECT_BINARY_DIR}"/include/*.h
)
set(xmlParserSharedLib xmlParser)
set(xmlParserStaticLib xmlParserStatic)
add_library(${xmlParserStaticLib}
STATIC
${SOURCE_FILES})
add_library(${xmlParserSharedLib}
SHARED
${SOURCE_FILES})
set_target_properties(${xmlParserStaticLib} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE})
set_target_properties(${xmlParserSharedLib} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE})
#install(TARGETS ${xmlParserSharedLib} ${xmlParserStaticLib} DESTINATION lib)
#install(FILES ${INCLUDE_FILES} DESTINATION include)
if(CXXTEST_FOUND)
set(xmlParser_test_include "${PROJECT_SOURCE_DIR}/unitary-test/include")
set(xmlParser_test_src "unitary-test/src")
set(xmlParser_test_build "unitary-test/build")
set(CXXTEST_USE_PYTHON TRUE)
include_directories(${CXXTEST_INCLUDE_DIR})
set(XmlElementTest ${xmlParser_test_build}/XmlElementTest)
CXXTEST_ADD_TEST(${XmlElementTest} ${xmlParser_test_src}/XmlElementTest.cpp
${xmlParser_test_include}/XmlElementTest.h)
target_link_libraries(${XmlElementTest} ${xmlParserStaticLib})
endif()
--
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