From 7aace6a9d28b02c4325610255dc8afe198f02c4d Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@openwide.fr>
Date: Wed, 12 Aug 2015 10:54:32 +0200
Subject: [PATCH] Use PROJECT_NAME instead of CMAKE_PROJECT_NAME

In order to support a top level CMakeLists.txt, use the current project
name instead of the top level one.

This patch has been submitted upstream:
https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
 apps/demo_cn_console/CMakeLists.txt             |  2 +-
 apps/demo_cn_console/linux.cmake                |  2 +-
 apps/demo_mn_console/CMakeLists.txt             |  4 ++--
 apps/demo_mn_console/linux.cmake                |  2 +-
 apps/demo_mn_qt/CMakeLists.txt                  |  4 ++--
 apps/demo_mn_qt/linux.cmake                     |  2 +-
 drivers/linux/drv_daemon_pcap/CMakeLists.txt    |  2 +-
 drivers/linux/drv_kernelmod_edrv/CMakeLists.txt | 10 +++++-----
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/apps/demo_cn_console/CMakeLists.txt b/apps/demo_cn_console/CMakeLists.txt
index cd3b418..c5a47a8 100644
--- a/apps/demo_cn_console/CMakeLists.txt
+++ b/apps/demo_cn_console/CMakeLists.txt
@@ -112,6 +112,6 @@ TARGET_LINK_LIBRARIES(demo_cn_console ${ARCH_LIBRARIES})
 ################################################################################
 # Installation rules
 
-INSTALL(TARGETS demo_cn_console RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(TARGETS demo_cn_console RUNTIME DESTINATION ${PROJECT_NAME})
 
 
diff --git a/apps/demo_cn_console/linux.cmake b/apps/demo_cn_console/linux.cmake
index 409bf11..76e381d 100644
--- a/apps/demo_cn_console/linux.cmake
+++ b/apps/demo_cn_console/linux.cmake
@@ -53,5 +53,5 @@ SET (ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt)
 ################################################################################
 # Set architecture specific installation files
 
-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME})
 
diff --git a/apps/demo_mn_console/CMakeLists.txt b/apps/demo_mn_console/CMakeLists.txt
index 0c54a98..d8df68e 100644
--- a/apps/demo_mn_console/CMakeLists.txt
+++ b/apps/demo_mn_console/CMakeLists.txt
@@ -120,6 +120,6 @@ TARGET_LINK_LIBRARIES(demo_mn_console ${ARCH_LIBRARIES})
 ################################################################################
 # Installation rules
 
-INSTALL(TARGETS demo_mn_console RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(TARGETS demo_mn_console RUNTIME DESTINATION ${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${PROJECT_NAME})
 
diff --git a/apps/demo_mn_console/linux.cmake b/apps/demo_mn_console/linux.cmake
index a9e9072..a994928 100644
--- a/apps/demo_mn_console/linux.cmake
+++ b/apps/demo_mn_console/linux.cmake
@@ -53,5 +53,5 @@ SET (ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt)
 ################################################################################
 # Set architecture specific installation files
 
-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME})
 
diff --git a/apps/demo_mn_qt/CMakeLists.txt b/apps/demo_mn_qt/CMakeLists.txt
index ff3a9aa..282a9d8 100644
--- a/apps/demo_mn_qt/CMakeLists.txt
+++ b/apps/demo_mn_qt/CMakeLists.txt
@@ -161,5 +161,5 @@ TARGET_LINK_LIBRARIES(demo_mn_qt ${ARCH_LIBRARIES} ${QT_LIBRARIES})
 ################################################################################
 # Installation rules
 
-INSTALL(TARGETS demo_mn_qt RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(TARGETS demo_mn_qt RUNTIME DESTINATION ${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${PROJECT_NAME})
diff --git a/apps/demo_mn_qt/linux.cmake b/apps/demo_mn_qt/linux.cmake
index 6f19ff2..6ed75ee 100644
--- a/apps/demo_mn_qt/linux.cmake
+++ b/apps/demo_mn_qt/linux.cmake
@@ -45,5 +45,5 @@ SET(ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt)
 ################################################################################
 # Set architecture specific installation files
 
-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME})
 
diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
index 9041e4d..2702abd 100644
--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
@@ -136,5 +136,5 @@ SET_PROPERTY(TARGET ${EXE_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEB
 TARGET_LINK_LIBRARIES(${EXE_NAME} ${OPLKLIB} ${ARCH_LIBRARIES})
 
 # add installation rules
-INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${PROJECT_NAME})
 
diff --git a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
index af85f86..59400c0 100644
--- a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
+++ b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
@@ -301,8 +301,8 @@ ADD_CUSTOM_TARGET(
 ################################################################################
 # add installation rules
 
-INSTALL(FILES ${MODULE_OUTPUT_DIR}/${MODULE_NAME}.ko DESTINATION ${CMAKE_PROJECT_NAME})
-INSTALL(FILES ${TOOLS_DIR}/linux/50-openPOWERLINK.rules DESTINATION ${CMAKE_PROJECT_NAME})
-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkload DESTINATION ${CMAKE_PROJECT_NAME})
-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkunload DESTINATION ${CMAKE_PROJECT_NAME})
-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/devices.txt DESTINATION ${CMAKE_PROJECT_NAME})
+INSTALL(FILES ${MODULE_OUTPUT_DIR}/${MODULE_NAME}.ko DESTINATION ${PROJECT_NAME})
+INSTALL(FILES ${TOOLS_DIR}/linux/50-openPOWERLINK.rules DESTINATION ${PROJECT_NAME})
+INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkload DESTINATION ${PROJECT_NAME})
+INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkunload DESTINATION ${PROJECT_NAME})
+INSTALL(PROGRAMS ${TOOLS_DIR}/linux/devices.txt DESTINATION ${PROJECT_NAME})
-- 
2.4.3

