Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cmake: fix smpi install dirs (absolute arg)
authorMillian Poquet <millian.poquet@inria.fr>
Thu, 15 Jul 2021 09:09:09 +0000 (11:09 +0200)
committerMillian Poquet <millian.poquet@inria.fr>
Thu, 15 Jul 2021 09:09:09 +0000 (11:09 +0200)
Previous code assumed that the following variables were relative paths
- CMAKE_INSTALL_INCLUDEDIR
- CMAKE_INSTALL_LIBDIR

However, using absolute paths there is totally legal in CMake,
and doing so broke installed paths in smpicc/smpicxx.

Fix uses the CMAKE_INSTALL_FULL_<dir> variant instead,
which should work in this case and generally be more robust.

FULL variants exist since at least cmake-3.0.0 so it should be available
everywhere (cmake-3.0.0 was released on June 2014).

References:
- https://cmake.org/cmake/help/latest/command/install.html
- https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html

CMakeLists.txt

index ae94089..df9907e 100644 (file)
@@ -548,8 +548,8 @@ file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH) # Definiti
 
 ### SMPI script used when simgrid is installed
 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
-set(includedir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
-set(libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
+set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
 set(includeflag "-I${includedir} -I${includedir}/smpi")
 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${libdir}")
 if(NS3_LIBRARY_PATH)