From cbd3010345ab8432e79f0d0b49bddaed74f8e929 Mon Sep 17 00:00:00 2001 From: Peter Nordin Date: Mon, 9 Dec 2024 23:05:13 +0100 Subject: [PATCH] Cleanup hopsanremote CMake files --- hopsanremote/CMakeLists.txt | 2 ++ .../hopsanaddressserver/CMakeLists.txt | 15 +++++--------- .../hopsanremoteclient/CMakeLists.txt | 16 +++++---------- hopsanremote/hopsanserver/CMakeLists.txt | 15 +++++--------- .../hopsanservermonitor/CMakeLists.txt | 15 +++++--------- .../hopsanserverworker/CMakeLists.txt | 15 +++++--------- .../libhopsanremoteclient/CMakeLists.txt | 20 ++++++------------- .../libhopsanremotecommon/CMakeLists.txt | 19 +++++------------- 8 files changed, 38 insertions(+), 79 deletions(-) diff --git a/hopsanremote/CMakeLists.txt b/hopsanremote/CMakeLists.txt index ddd6a3132..0b214d07a 100644 --- a/hopsanremote/CMakeLists.txt +++ b/hopsanremote/CMakeLists.txt @@ -1,4 +1,6 @@ project(HopsanRemote) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_DEBUG_POSTFIX _d) include(${CMAKE_CURRENT_LIST_DIR}/../helpers.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../dependencies/zeromq.cmake) diff --git a/hopsanremote/hopsanaddressserver/CMakeLists.txt b/hopsanremote/hopsanaddressserver/CMakeLists.txt index 5087904e9..a23c9bbdd 100644 --- a/hopsanremote/hopsanaddressserver/CMakeLists.txt +++ b/hopsanremote/hopsanaddressserver/CMakeLists.txt @@ -1,22 +1,17 @@ -project(HopsanAddressServer) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) find_package(Threads REQUIRED) -set(target_name hopsanaddresserver) - file(GLOB srcfiles *.cpp *.h) -add_executable(${target_name} ${srcfiles}) +add_executable(hopsanaddresserver ${srcfiles}) -target_include_directories(${target_name} PRIVATE +target_include_directories(hopsanaddresserver PRIVATE $ $) -target_link_libraries(${target_name} libhopsanremoteclient Threads::Threads) +target_link_libraries(hopsanaddresserver libhopsanremoteclient Threads::Threads) -set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") +set_target_properties(hopsanaddresserver PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") -install(TARGETS ${target_name} +install(TARGETS hopsanaddresserver RUNTIME DESTINATION bin ) diff --git a/hopsanremote/hopsanremoteclient/CMakeLists.txt b/hopsanremote/hopsanremoteclient/CMakeLists.txt index 1f946f356..ae37c4cc2 100644 --- a/hopsanremote/hopsanremoteclient/CMakeLists.txt +++ b/hopsanremote/hopsanremoteclient/CMakeLists.txt @@ -1,19 +1,13 @@ -project(HopsanRemoteClient) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) +add_executable(hopsanremoteclient main.cpp) -set(target_name hopsanremoteclient) - -add_executable(${target_name} main.cpp) - -target_include_directories(${target_name} PRIVATE +target_include_directories(hopsanremoteclient PRIVATE $ $) -target_link_libraries(${target_name} libhopsanremoteclient) +target_link_libraries(hopsanremoteclient libhopsanremoteclient) -set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") +set_target_properties(hopsanremoteclient PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") -install(TARGETS ${target_name} +install(TARGETS hopsanremoteclient RUNTIME DESTINATION bin ) diff --git a/hopsanremote/hopsanserver/CMakeLists.txt b/hopsanremote/hopsanserver/CMakeLists.txt index 956187cfe..5b3f2f9d4 100644 --- a/hopsanremote/hopsanserver/CMakeLists.txt +++ b/hopsanremote/hopsanserver/CMakeLists.txt @@ -1,20 +1,15 @@ -project(HopsanServer) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) find_package(Threads REQUIRED) -set(target_name hopsanserver) +add_executable(hopsanserver main.cpp) -add_executable(${target_name} main.cpp) - -target_include_directories(${target_name} PRIVATE +target_include_directories(hopsanserver PRIVATE $ $) -target_link_libraries(${target_name} libhopsanremotecommon Threads::Threads) +target_link_libraries(hopsanserver libhopsanremotecommon Threads::Threads) -set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") +set_target_properties(hopsanserver PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") -install(TARGETS ${target_name} +install(TARGETS hopsanserver RUNTIME DESTINATION bin ) diff --git a/hopsanremote/hopsanservermonitor/CMakeLists.txt b/hopsanremote/hopsanservermonitor/CMakeLists.txt index 613ff6603..dd7f74141 100644 --- a/hopsanremote/hopsanservermonitor/CMakeLists.txt +++ b/hopsanremote/hopsanservermonitor/CMakeLists.txt @@ -1,20 +1,15 @@ -project(HopsanServerMonitor) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) find_package(Threads REQUIRED) -set(target_name hopsanservermonitor) +add_executable(hopsanservermonitor main.cpp) -add_executable(${target_name} main.cpp) - -target_include_directories(${target_name} PRIVATE +target_include_directories(hopsanservermonitor PRIVATE $ $) -target_link_libraries(${target_name} libhopsanremoteclient libhopsanremotecommon Threads::Threads) +target_link_libraries(hopsanservermonitor libhopsanremoteclient libhopsanremotecommon Threads::Threads) -set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") +set_target_properties(hopsanservermonitor PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") -install(TARGETS ${target_name} +install(TARGETS hopsanservermonitor RUNTIME DESTINATION bin ) diff --git a/hopsanremote/hopsanserverworker/CMakeLists.txt b/hopsanremote/hopsanserverworker/CMakeLists.txt index 04febe6c6..eccd1d094 100644 --- a/hopsanremote/hopsanserverworker/CMakeLists.txt +++ b/hopsanremote/hopsanserverworker/CMakeLists.txt @@ -1,21 +1,16 @@ -project(HopsanServerWorker) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) find_package(Threads REQUIRED) -set(target_name hopsanserverworker) +add_executable(hopsanserverworker main.cpp) -add_executable(${target_name} main.cpp) - -target_include_directories(${target_name} PRIVATE +target_include_directories(hopsanserverworker PRIVATE $ $ $) -target_link_libraries(${target_name} libhopsanremotecommon hopsancore Threads::Threads) +target_link_libraries(hopsanserverworker libhopsanremotecommon hopsancore Threads::Threads) -set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") +set_target_properties(hopsanserverworker PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") -install(TARGETS ${target_name} +install(TARGETS hopsanserverworker RUNTIME DESTINATION bin ) diff --git a/hopsanremote/libhopsanremoteclient/CMakeLists.txt b/hopsanremote/libhopsanremoteclient/CMakeLists.txt index dd99c90b6..510640c41 100644 --- a/hopsanremote/libhopsanremoteclient/CMakeLists.txt +++ b/hopsanremote/libhopsanremoteclient/CMakeLists.txt @@ -1,27 +1,19 @@ -project(Ops) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) -if(WIN32) - set(CMAKE_SHARED_LIBRARY_PREFIX "") -endif() find_package(Threads REQUIRED) -set(target_name libhopsanremoteclient) - file(GLOB_RECURSE srcfiles src/*.cpp include/*.h include/*.hpp) -add_library(${target_name} STATIC ${srcfiles}) -set_target_properties(${target_name} PROPERTIES OUTPUT_NAME hopsanremoteclient) +add_library(libhopsanremoteclient STATIC ${srcfiles}) +set_target_properties(libhopsanremoteclient PROPERTIES OUTPUT_NAME hopsanremoteclient) -target_include_directories(${target_name} PUBLIC +target_include_directories(libhopsanremoteclient PUBLIC $ $) -target_link_libraries(${target_name} libhopsanremotecommon Threads::Threads) +target_link_libraries(libhopsanremoteclient libhopsanremotecommon Threads::Threads) -set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "\$ORIGIN") +set_target_properties(libhopsanremoteclient PROPERTIES INSTALL_RPATH "\$ORIGIN") -install(TARGETS ${target_name} +install(TARGETS libhopsanremoteclient RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib diff --git a/hopsanremote/libhopsanremotecommon/CMakeLists.txt b/hopsanremote/libhopsanremotecommon/CMakeLists.txt index e3118d9e2..08ba124bd 100644 --- a/hopsanremote/libhopsanremotecommon/CMakeLists.txt +++ b/hopsanremote/libhopsanremotecommon/CMakeLists.txt @@ -1,27 +1,18 @@ -project(Ops) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_DEBUG_POSTFIX _d) -if(WIN32) - set(CMAKE_SHARED_LIBRARY_PREFIX "") -endif() - -set(target_name libhopsanremotecommon) - include(${CMAKE_CURRENT_LIST_DIR}/../../dependencies/zeromq.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../../dependencies/msgpack.cmake) file(GLOB_RECURSE srcfiles src/*.cpp include/*.h include/*.hpp) -add_library(${target_name} STATIC ${srcfiles}) -set_target_properties(${target_name} PROPERTIES OUTPUT_NAME hopsanremotecommon) +add_library(libhopsanremotecommon STATIC ${srcfiles}) +set_target_properties(libhopsanremotecommon PROPERTIES OUTPUT_NAME hopsanremotecommon) -target_include_directories(${target_name} PUBLIC +target_include_directories(libhopsanremotecommon PUBLIC $ $) -target_link_libraries(${target_name} PUBLIC libzmq msgpackc-cxx) +target_link_libraries(libhopsanremotecommon PUBLIC libzmq msgpackc-cxx) -install(TARGETS ${target_name} +install(TARGETS libhopsanremotecommon RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib