Skip to content

Commit

Permalink
Cleanup hopsanremote CMake files
Browse files Browse the repository at this point in the history
  • Loading branch information
peterNordin committed Dec 10, 2024
1 parent cee05d4 commit cbd3010
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 79 deletions.
2 changes: 2 additions & 0 deletions hopsanremote/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
15 changes: 5 additions & 10 deletions hopsanremote/hopsanaddressserver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../dependencies/tclap/include>)

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
)
16 changes: 5 additions & 11 deletions hopsanremote/hopsanremoteclient/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../dependencies/tclap/include>)

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
)
15 changes: 5 additions & 10 deletions hopsanremote/hopsanserver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../../dependencies/tclap/include>)

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
)
15 changes: 5 additions & 10 deletions hopsanremote/hopsanservermonitor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../dependencies/tclap/include>)

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
)
15 changes: 5 additions & 10 deletions hopsanremote/hopsanserverworker/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../../dependencies/tclap/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../../Utilities>)

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
)
20 changes: 6 additions & 14 deletions hopsanremote/libhopsanremoteclient/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

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
Expand Down
19 changes: 5 additions & 14 deletions hopsanremote/libhopsanremotecommon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

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
Expand Down

0 comments on commit cbd3010

Please sign in to comment.