aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-09-09 15:49:00 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-09-10 11:46:30 -0300
commitfedb9b3daac568c5c6f23dec0fd97c407f3e8023 (patch)
treea67f780ec984433990d3e2f0c6df51e01fe8aece
parent0c3d5644e0d3eb8b7955c92d0cf147f0ae84869d (diff)
Created cmake option 'ENABLE_VERSION_SUFFIX' to use version on generated files to allow multiples version installed simultaneous.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--CMakeLists.txt40
-rw-r--r--data/CMakeLists.txt25
-rw-r--r--data/GeneratorRunnerConfig.cmake.in (renamed from GeneratorRunnerConfig.cmake.in)10
-rw-r--r--data/GeneratorRunnerConfigVersion.cmake.in (renamed from GeneratorRunnerConfigVersion.cmake.in)0
l---------data/docgenerator.1 (renamed from docgenerator.1)0
-rw-r--r--data/generatorrunner.1 (renamed from generatorrunner.1)0
-rw-r--r--data/generatorrunner.pc.in (renamed from generatorrunner.pc.in)6
-rw-r--r--generators/qtdoc/CMakeLists.txt2
8 files changed, 53 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5139713..91a798bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ find_package(Qt4 4.5.0 REQUIRED)
find_package(ApiExtractor 0.8 REQUIRED)
option(BUILD_TESTS "Build tests." TRUE)
+option(ENABLE_VERSION_SUFFIX "Used to use current version in suffix to generated files. This is used to allow multiples versions installed simultaneous." FALSE)
if(MSVC)
set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /EHsc /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS")
@@ -39,8 +40,14 @@ set(generator_MINOR_VERSION "6")
set(generator_MICRO_VERSION "1")
set(generator_VERSION "${generator_MAJOR_VERSION}.${generator_MINOR_VERSION}.${generator_MICRO_VERSION}")
set(generator_SOVERSION "${generator_MAJOR_VERSION}.${generator_MINOR_VERSION}")
+set(USE_GENERATOR_VERSION_SUFFIX FALSE CACHE BOOL "This suffix allow to have various generator version installed simultaneous.")
+if (ENABLE_VERSION_SUFFIX)
+ set(generator_SUFFIX "-${generator_MAJOR_VERSION}.${generator_MINOR_VERSION}")
+else()
+ set(generator_SUFFIX "")
+endif()
-set(generator_plugin_DIR ${LIB_INSTALL_DIR}/generatorrunner)
+set(generator_plugin_DIR ${LIB_INSTALL_DIR}/generatorrunner${generator_SUFFIX})
add_definitions(${QT_DEFINITIONS})
@@ -55,22 +62,17 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
add_library(genrunner SHARED generator.cpp)
set_target_properties(genrunner PROPERTIES VERSION ${generator_VERSION} DEFINE_SYMBOL GENRUNNER_EXPORTS)
target_link_libraries(genrunner ${QT_QTCORE_LIBRARY} ${APIEXTRACTOR_LIBRARY})
-set_target_properties(genrunner PROPERTIES VERSION ${generator_VERSION} SOVERSION ${generator_SOVERSION})
+set_target_properties(genrunner PROPERTIES VERSION ${generator_VERSION}
+ SOVERSION ${generator_SOVERSION}
+ OUTPUT_NAME genrunner${generator_SUFFIX})
add_executable(generatorrunner main.cpp)
+set_target_properties(generatorrunner PROPERTIES OUTPUT_NAME generatorrunner${generator_SUFFIX})
target_link_libraries(generatorrunner
genrunner
${APIEXTRACTOR_LIBRARY}
${QT_QTCORE_LIBRARY})
-# create pkg-config file
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/generatorrunner.pc.in"
- "${CMAKE_CURRENT_BINARY_DIR}/generatorrunner.pc" @ONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GeneratorRunnerConfig.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfig.cmake" @ONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GeneratorRunnerConfigVersion.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfigVersion.cmake" @ONLY)
-
# uninstall target
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@@ -90,22 +92,14 @@ add_custom_target(dist
echo "Source package created at ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2.\n"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
+set(GENERATORRUNNER_INC_DIR "generatorrunner${generator_SUFFIX}")
install(TARGETS genrunner LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION bin)
install(TARGETS generatorrunner DESTINATION bin)
-install(FILES generator.h DESTINATION include/generatorrunner)
-install(FILES generatorrunnermacros.h DESTINATION include/generatorrunner)
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/generatorrunner.pc" DESTINATION
- "${LIB_INSTALL_DIR}/pkgconfig")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfig.cmake"
- DESTINATION "${LIB_INSTALL_DIR}/cmake/GeneratorRunner-${generator_VERSION}")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfigVersion.cmake"
- DESTINATION "${LIB_INSTALL_DIR}/cmake/GeneratorRunner-${generator_VERSION}")
-
-#FIXME: manpages should be installed only on Linux targets
-file(GLOB manpages "${CMAKE_CURRENT_SOURCE_DIR}/*.1")
-install(FILES ${manpages} DESTINATION share/man/man1)
+install(FILES generator.h DESTINATION include/${GENERATORRUNNER_INC_DIR})
+install(FILES generatorrunnermacros.h DESTINATION include/${GENERATORRUNNER_INC_DIR})
if (BUILD_TESTS)
enable_testing()
@@ -116,4 +110,4 @@ add_subdirectory(generators)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
-
+add_subdirectory(data)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 00000000..9b150f35
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,25 @@
+# create pkg-config file
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/generatorrunner.pc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/generatorrunner${generator_SUFFIX}.pc" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GeneratorRunnerConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfig.cmake" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GeneratorRunnerConfigVersion.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfigVersion.cmake" @ONLY)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/generatorrunner${generator_SUFFIX}.pc" DESTINATION
+ "${LIB_INSTALL_DIR}/pkgconfig")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfig.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/GeneratorRunner-${generator_VERSION}")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/GeneratorRunnerConfigVersion.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/GeneratorRunner-${generator_VERSION}")
+
+#FIXME: manpages should be installed only on Linux targets
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/docgenerator.1"
+ "${CMAKE_CURRENT_BINARY_DIR}/docgenerator${generator_SUFFIX}.1")
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/generatorrunner.1"
+ "${CMAKE_CURRENT_BINARY_DIR}/generatorrunner${generator_SUFFIX}.1")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/generatorrunner.pc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/generatorrunner${generator_SUFFIX}.pc" @ONLY)
+
+file(GLOB manpages "${CMAKE_CURRENT_BINARY_DIR}/*${generator_SUFFIX}.1")
+install(FILES ${manpages} DESTINATION share/man/man1)
diff --git a/GeneratorRunnerConfig.cmake.in b/data/GeneratorRunnerConfig.cmake.in
index f8977272..6b7a06dc 100644
--- a/GeneratorRunnerConfig.cmake.in
+++ b/data/GeneratorRunnerConfig.cmake.in
@@ -1,13 +1,15 @@
# GENERATORRUNNER_INCLUDE_DIR - Directories to include to use GENERATORRUNNER
# GENERATORRUNNER_LIBRARIES - Files to link against to use GENERATORRUNNER
# GENERATORRUNNER_PLUGIN_DIR - Where to find/put plugins for generator runner
+# GENERATORRUNNER_BINARY - Executable name
-SET(GENERATORRUNNER_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/generatorrunner")
+SET(GENERATORRUNNER_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/generatorrunner@generator_SUFFIX@")
if(MSVC)
- SET(GENERATORRUNNER_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@genrunner.lib")
+ SET(GENERATORRUNNER_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@genrunner@generator_SUFFIX@.lib")
elseif(WIN32)
- SET(GENERATORRUNNER_LIBRARY "@CMAKE_INSTALL_PREFIX@/bin/@CMAKE_SHARED_LIBRARY_PREFIX@genrunner@CMAKE_SHARED_LIBRARY_SUFFIX@")
+ SET(GENERATORRUNNER_LIBRARY "@CMAKE_INSTALL_PREFIX@/bin/@CMAKE_SHARED_LIBRARY_PREFIX@genrunner@generator_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
else()
- SET(GENERATORRUNNER_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@genrunner@CMAKE_SHARED_LIBRARY_SUFFIX@")
+ SET(GENERATORRUNNER_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@genrunner@generator_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
endif()
SET(GENERATORRUNNER_PLUGIN_DIR @generator_plugin_DIR@)
+SET(GENERATORRUNNER_BINARY generatorrunner@generator_SUFFIX@)
diff --git a/GeneratorRunnerConfigVersion.cmake.in b/data/GeneratorRunnerConfigVersion.cmake.in
index fe0e36e5..fe0e36e5 100644
--- a/GeneratorRunnerConfigVersion.cmake.in
+++ b/data/GeneratorRunnerConfigVersion.cmake.in
diff --git a/docgenerator.1 b/data/docgenerator.1
index c65282f9..c65282f9 120000
--- a/docgenerator.1
+++ b/data/docgenerator.1
diff --git a/generatorrunner.1 b/data/generatorrunner.1
index 60749d95..60749d95 100644
--- a/generatorrunner.1
+++ b/data/generatorrunner.1
diff --git a/generatorrunner.pc.in b/data/generatorrunner.pc.in
index 88c8deea..a566f435 100644
--- a/generatorrunner.pc.in
+++ b/data/generatorrunner.pc.in
@@ -4,10 +4,10 @@ libdir=@LIB_INSTALL_DIR@
includedir=@CMAKE_INSTALL_PREFIX@/include
-Name: generatorrunner
+Name: generatorrunner@generator_SUFFIX@
Description: Generator Runner loads and calls binding generator front-ends.
Requires: apiextractor
Version: @generatorrunner_VERSION@
-Libs: -L${libdir} -lgenrunner
-Cflags: -I${includedir}
+Libs: -L${libdir} -lgenrunner@generator_SUFFIX@
+Cflags: -I${includedir}@generator_SUFFIX@
diff --git a/generators/qtdoc/CMakeLists.txt b/generators/qtdoc/CMakeLists.txt
index 8b2f9e06..118cfd7c 100644
--- a/generators/qtdoc/CMakeLists.txt
+++ b/generators/qtdoc/CMakeLists.txt
@@ -5,6 +5,8 @@ qtdocgenerator.cpp
)
add_executable(docgenerator main.cpp)
+set_target_properties(docgenerator PROPERTIES OUTPUT_NAME docgenerator${generator_SUFFIX})
+
target_link_libraries(docgenerator ${QT_QTCORE_LIBRARY})
add_library(qtdoc_generator SHARED ${qtdoc_generator_SRC})