Fixed install target
[u/mrichter/AliRoot.git] / cmake / ALICE_CMake.cmake
index 8764f83..996f60e 100644 (file)
@@ -360,9 +360,9 @@ macro(ALICE_BuildModule)
       get_property(EXCLUDEPACKAGE TARGET ${PACKAGE} PROPERTY EXCLUDE_FROM_ALL) 
       if(NOT EXCLUDEPACKAGE)
         install(TARGETS ${PACKAGE} 
-                RUNTIME DESTINATION bin
-                LIBRARY DESTINATION lib
-                ARCHIVE DESTINATION bin)
+                RUNTIME DESTINATION bin/tgt_${ALICE_TARGET}
+                LIBRARY DESTINATION lib/tgt_${ALICE_TARGET}
+                ARCHIVE DESTINATION bin/tgt_${ALICE_TARGET})
       endif(NOT EXCLUDEPACKAGE)
   endforeach(PACKAGEFILE)
 
@@ -430,6 +430,7 @@ macro(ALICE_BuildLibrary)
   include_directories(${CMAKE_INCLUDE_EXPORT_DIRECTORY})
   
   add_library(${PACKAGE} SHARED ${PCS} ${PFS} ${PS} ${PDS})
+  set_target_properties(${PACKAGE} PROPERTIES SUFFIX .so)  
   
 
   if(PELIBS OR SHLIB)
@@ -518,8 +519,8 @@ macro(ALICE_BuildExecutable)
     add_dependencies(${PACKAGE}-static libAliMDC root-static-libs)
     target_link_libraries(${PACKAGE}-static ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${ROOTLIBDIR}/libRoot.a ${ROOTLIBDIR}/libfreetype.a ${ROOTLIBDIR}/libpcre.a -pthread -ldl -lcurses)
 
-    install(TARGETS ${PACKAGE}-static RUNTIME DESTINATION bin COMPONENT MDC)
-    install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${ROOTLIBDIR}/libRoot.a ${ROOTLIBDIR}/libfreetype.a ${ROOTLIBDIR}/libpcre.a DESTINATION lib COMPONENT MDC)
+    install(TARGETS ${PACKAGE}-static RUNTIME DESTINATION bin/tgt_${ALICE_TARGET} COMPONENT MDC)
+    install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${ROOTLIBDIR}/libRoot.a ${ROOTLIBDIR}/libfreetype.a ${ROOTLIBDIR}/libpcre.a DESTINATION lib/tgt_${ALICE_TARGET} COMPONENT MDC)
     install(FILES ${PROJECT_SOURCE_DIR}/RAW/mdc.h DESTINATION include COMPONENT MDC)
     set(CPACK_RPM_PACKAGE_SUMMARY "AliMDC static libraries")
     set(CPACK_RPM_PACKAGE_NAME "alimdc")
@@ -578,24 +579,27 @@ endmacro(ALICE_GenerateLinkDef)
 
 macro(ALICE_BuildPAR)
   if(EXISTS ${ALICE_ROOT}/${MODULE}/PROOF-INF.${PACKAGE})
-    add_custom_target(${PACKAGE}.par
-                      COMMAND sed -e 's/include .\(ROOTSYS\)\\/test\\/Makefile.arch/include Makefile.arch/\; s/PACKAGE = .*/PACKAGE = ${PACKAGE}/' < Makefile > ${PACKAGE}/Makefile
-                      COMMAND cp -pR ${ROOTSYS}/test/Makefile.arch ${PACKAGE}/Makefile.arch
-                      COMMAND cp -pR PROOF-INF.${PACKAGE} ${PACKAGE}/PROOF-INF
-                      COMMAND cp -pR lib${PACKAGE}.pkg ${PACKAGE}
-                      COMMAND tar --exclude=.svn -czhf ${CMAKE_BINARY_DIR}/${PACKAGE}.par ${PACKAGE}
-                      COMMAND ${CMAKE_COMMAND} -E remove_directory ${PACKAGE}
-                      COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red --bold "${PACKAGE}.par has been created in ${CMAKE_BINARY_DIR}"
-                      DEPENDS ${SRCS} ${HDRS} ${FSRCS} ${DHDR}
-                      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
-
+    set(PARSRCS)
     foreach(file ${SRCS} ${HDRS} ${FSRCS} ${DHDR})
       get_filename_component(srcdir ${file} PATH)
-      add_custom_command(OUTPUT ${file}                         
-                         COMMAND mkdir -p ${PACKAGE}/${srcdir}
-                         COMMAND cp -pR ${file} ${PACKAGE}/${file}
+      add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/${file}-par                         
+                         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/${srcdir}
+                         COMMAND cp -pR ${file} ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/${file}
                          WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+      list(APPEND PARSRCS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/${file}-par)
     endforeach(file ${SRCS} ${HDRS} ${FSRCS} ${DHDR})
+    
+    add_custom_target(${PACKAGE}.par
+                      COMMAND sed -e 's/include .\(ROOTSYS\)\\/test\\/Makefile.arch/include Makefile.arch/\; s/PACKAGE = .*/PACKAGE = ${PACKAGE}/' < Makefile > ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/Makefile
+                      COMMAND cp -pR ${ROOTSYS}/test/Makefile.arch ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/Makefile.arch
+                      COMMAND cp -pR PROOF-INF.${PACKAGE} ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}/PROOF-INF
+                      COMMAND cp -pR lib${PACKAGE}.pkg ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}
+                      COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR} tar --exclude=.svn -czhf ${CMAKE_BINARY_DIR}/${PACKAGE}.par ${PACKAGE}
+                      COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}
+                      COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red --bold "${PACKAGE}.par has been created in ${CMAKE_BINARY_DIR}"
+                      DEPENDS ${PARSRCS} 
+                      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+
 
     add_dependencies(par-all ${PACKAGE}.par)
     add_dependencies(${MODULE}-par-all ${PACKAGE}.par)