Skip to content

Commit

Permalink
#104 remove explicit uses of CMAKE_INSTALL_PREFIX in install paths
Browse files Browse the repository at this point in the history
  • Loading branch information
valleefred authored and gautierbureau committed Nov 8, 2021
1 parent 60621b7 commit 4c823d3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 25 deletions.
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,12 @@ set(DYNAWO_ALGORITHMS_VERSION_STRING ${DYNAWO_ALGORITHMS_VERSION_MAJOR}.${DYNAWO
# Set repertory name
set(BINDIR_NAME bin)
set(SHAREDIR_NAME share)
set(SBINDIR_NAME sbin)
set(INCLUDEDIR_NAME include)
set(LIBDIR_NAME lib)
set(DOCDIR_NAME doxygen)

get_filename_component(DYNAWO_HOME ${DYNAWO_HOME} ABSOLUTE)

# Set some install directories variables
set(INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(libdir ${INSTALL_PREFIX}/${LIBDIR_NAME})
set(includedir ${INSTALL_PREFIX}/${INCLUDEDIR_NAME})
set(docdir ${INSTALL_PREFIX}/${DOCDIR_NAME})
set(bindir ${INSTALL_PREFIX}/${BINDIR_NAME})
set(sharedir ${INSTALL_PREFIX}/${SHAREDIR_NAME})
set(sbindir ${INSTALL_PREFIX}/${SBINDIR_NAME})

# If C++11 is enabled, check flags availability
set(CXX11_ENABLED ${CXX11_ENABLED} CACHE BOOL "")
if(CXX11_ENABLED)
Expand Down
2 changes: 1 addition & 1 deletion doxygen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# of simulation tools for power systems.

set(SRC_DIR ${PROJECT_SOURCE_DIR})
set(DOC_DIR ${docdir})
get_filename_component(DOC_DIR ${CMAKE_INSTALL_PREFIX}/${DOCDIR_NAME} ABSOLUTE)

# add a target to generate API documentation with Doxygen
find_package(Doxygen 1.8)
Expand Down
4 changes: 2 additions & 2 deletions sources/API/aggregatedResults/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(API_AGGREGATEDRES_SHARED
xsd/aggregatedResults.xsd
)

install(FILES ${API_AGGREGATEDRES_SHARED} DESTINATION ${sharedir}/xsd/)
install(FILES ${API_AGGREGATEDRES_SHARED} DESTINATION ${SHAREDIR_NAME}/xsd/)

set(API_AGGREGATEDRES_SOURCES
DYNAggrResXmlExporter.cpp
Expand All @@ -34,4 +34,4 @@ target_link_libraries(dynawo_algorithms_API_AggregatedResults
XMLSAXParser${LibXML_LINK_SUFFIX}
)

install(TARGETS dynawo_algorithms_API_AggregatedResults EXPORT dynawo_algorithms-targets DESTINATION ${libdir})
install(TARGETS dynawo_algorithms_API_AggregatedResults EXPORT dynawo_algorithms-targets DESTINATION ${LIBDIR_NAME})
6 changes: 3 additions & 3 deletions sources/API/multipleJobs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(API_MULTIPLEJOBS_SHARED
xsd/multipleJobs.xsd
)

install(FILES ${API_MULTIPLEJOBS_SHARED} DESTINATION ${sharedir}/xsd/)
install(FILES ${API_MULTIPLEJOBS_SHARED} DESTINATION ${SHAREDIR_NAME}/xsd/)

set(API_MULTIPLEJOBS_SOURCES
DYNMultipleJobs.cpp
Expand Down Expand Up @@ -42,5 +42,5 @@ target_link_libraries(dynawo_algorithms_API_MultipleJobs
XMLSAXParser${LibXML_LINK_SUFFIX}
)

install(TARGETS dynawo_algorithms_API_MultipleJobs EXPORT dynawo_algorithms-targets DESTINATION ${libdir})
install(FILES ${API_MULTIPLEJOBS_HEADERS} DESTINATION ${includedir})
install(TARGETS dynawo_algorithms_API_MultipleJobs EXPORT dynawo_algorithms-targets DESTINATION ${LIBDIR_NAME})
install(FILES ${API_MULTIPLEJOBS_HEADERS} DESTINATION ${INCLUDEDIR_NAME})
6 changes: 3 additions & 3 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ set(DYN_ALGO_INCLUDE_HEADERS
gitversion_algorithms.h
)

install(FILES ${DYN_ALGO_INCLUDE_HEADERS} DESTINATION ${includedir})
install(FILES ${DYN_ALGO_INCLUDE_HEADERS} DESTINATION ${INCLUDEDIR_NAME})

add_executable(dynawoAlgorithms ${DYN_ALGO_SOURCES})
target_link_libraries(dynawoAlgorithms
dynawo_algorithms_Launcher
$<$<NOT:$<BOOL:${USE_LEGACY_IIDM}>>:LibXml2::LibXml2>
)

install(PROGRAMS execDynawoAlgorithms.sh DESTINATION ${bindir})
install(PROGRAMS execDynawoAlgorithms.sh DESTINATION ${BINDIR_NAME})

set_target_properties(dynawoAlgorithms PROPERTIES VERSION ${DYNAWO_ALGORITHMS_VERSION_STRING})
install(TARGETS dynawoAlgorithms DESTINATION ${bindir})
install(TARGETS dynawoAlgorithms DESTINATION ${BINDIR_NAME})

# explicitly say that the executable depends on custom target
add_dependencies(dynawoAlgorithms revisiontag)
Expand Down
6 changes: 3 additions & 3 deletions sources/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set(DYN_ALGO_COMMON_HEADERS

add_library(dynawo_algorithms_Common SHARED ${DYN_ALGO_COMMON_SOURCES})
add_dependencies(dynawo_algorithms_Common create_keys_files)
install(FILES ${DYN_ALGO_COMMON_HEADERS} DESTINATION ${includedir})
install(FILES ${DYN_ALGO_COMMON_HEADERS} DESTINATION ${INCLUDEDIR_NAME})

target_include_directories(dynawo_algorithms_Common
PUBLIC
Expand All @@ -79,5 +79,5 @@ target_link_libraries(dynawo_algorithms_Common
Dynawo::dynawo_Common
)

install(TARGETS dynawo_algorithms_Common EXPORT dynawo_algorithms-targets DESTINATION ${libdir})
install(FILES ${DICTIONARIES} ${DICTIONARIES_MAPPING} DESTINATION ${sharedir})
install(TARGETS dynawo_algorithms_Common EXPORT dynawo_algorithms-targets DESTINATION ${LIBDIR_NAME})
install(FILES ${DICTIONARIES} ${DICTIONARIES_MAPPING} DESTINATION ${SHAREDIR_NAME})
4 changes: 2 additions & 2 deletions sources/Launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(DYN_ALGO_LAUNCHER_HEADERS

add_library(dynawo_algorithms_Launcher SHARED ${DYN_ALGO_LAUNCHER_SOURCES})

install(FILES ${DYN_ALGO_LAUNCHER_HEADERS} DESTINATION ${includedir})
install(FILES ${DYN_ALGO_LAUNCHER_HEADERS} DESTINATION ${INCLUDEDIR_NAME})

target_include_directories(dynawo_algorithms_Launcher
INTERFACE
Expand All @@ -51,4 +51,4 @@ target_link_libraries(dynawo_algorithms_Launcher
Boost::program_options
libZIP::libZIP
)
install(TARGETS dynawo_algorithms_Launcher EXPORT dynawo_algorithms-targets DESTINATION ${libdir})
install(TARGETS dynawo_algorithms_Launcher EXPORT dynawo_algorithms-targets DESTINATION ${LIBDIR_NAME})
2 changes: 1 addition & 1 deletion sources/Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ target_link_libraries(dynawo_algorithms_Test_utils
$<$<NOT:$<BOOL:${USE_LEGACY_IIDM}>>:LibXml2::LibXml2>
)

install(TARGETS dynawo_algorithms_Test_utils EXPORT dynawo_algorithms-targets DESTINATION ${libdir})
install(TARGETS dynawo_algorithms_Test_utils EXPORT dynawo_algorithms-targets DESTINATION ${LIBDIR_NAME})

0 comments on commit 4c823d3

Please sign in to comment.