diff --git a/CMakeLists.txt b/CMakeLists.txt index ff9acfba05ca3a6238768839c2997f6f77a6f535..c8bf7fd3dcae60a7a2344257ab4e1f33beccf92e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,8 +75,6 @@ if(CM_ALL_VTK_OUTPUT) if(NOT VTK_FOUND) message(FATAL_ERROR "VTK not found, help CMake to find it by setting VTK_LIBRARY and VTK_INCLUDE_DIR") endif() - # todo(s.schulz): this can be replaced from 3.12 onwards with add_compile_definitions - add_compile_definitions("ALL_VTK_OUTPUT") endif(CM_ALL_VTK_OUTPUT) if (CM_ALL_DEBUG) @@ -97,7 +95,6 @@ endif(CM_ALL_USE_F08 AND MPI_Fortran_HAVE_F08_MODULE) if(CM_ALL_VORONOI) message(STATUS "compiling voro++ version in contrib/voro++") add_subdirectory(contrib/voro++) - add_compile_definitions("ALL_VORONOI_ACTIVE") endif() set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/stb) diff --git a/example/CMakeProject/build_all.sh b/example/CMakeProject/build_all.sh index 1acd12fe93dfd6850eb21117df8ba1cfa299f380..d212482d38c93648d5fe0a60abc7266b4f3f525c 100755 --- a/example/CMakeProject/build_all.sh +++ b/example/CMakeProject/build_all.sh @@ -38,6 +38,7 @@ build_all () { cmake --install "$ALL_BUILD_DIR" if [[ $ALL_INSTALL_DIR != $ALL_PACKAGE ]] then + rm -rf "$ALL_PACKAGE" mv "$ALL_INSTALL_DIR" "$ALL_PACKAGE" fi } diff --git a/misc/preprocess.sh b/misc/preprocess.sh index 1fa92ad3e52b0e44d36e7e1cfc5d3a444d309ac2..7864756e2170170f6ceb887b159cc065aca9e9ac 100755 --- a/misc/preprocess.sh +++ b/misc/preprocess.sh @@ -50,7 +50,7 @@ do DEFINES="$DEFINES -D$d" done -gcc -E -fdirectives-only $DEFINES -o ALL.ii ALL.hpp +cpp -undef -fdirectives-only $DEFINES -o ALL.ii ALL.hpp mkdir -p "${OUTFILE%/*}" cat ALL.ii | sed -e 's!// PPIGNORE <!#include <!' > "$OUTFILE" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef58417687f82280fe9b74e4d6e9604950866497..9d7cf93bb871d897a82646c949875f1e3d167d6c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,9 +17,11 @@ add_library (ALL ALL.cpp ALL_fortran.cpp ${ALL_HEADER_FILES}) if(CM_ALL_VTK_OUTPUT) target_include_directories(ALL PUBLIC ${VTK_INCLUDE_DIRS}) target_link_libraries(ALL PUBLIC ${VTK_LIBRARIES}) + target_compile_definitions(ALL PUBLIC ALL_VTK_OUTPUT) endif(CM_ALL_VTK_OUTPUT) if(CM_ALL_VORONOI) target_link_libraries(ALL PUBLIC voro) + target_compile_definitions(ALL PUBLIC ALL_VORONOI_ACTIVE) endif(CM_ALL_VORONOI) target_include_directories(ALL PUBLIC ${MPI_CXX_INCLUDE_PATH}) @@ -40,16 +42,8 @@ install(TARGETS ALL ARCHIVE DESTINATION lib INCLUDES DESTINATION include) -get_property(_glob_comp_def DIRECTORY PROPERTY COMPILE_DEFINITIONS) -add_custom_command( - TARGET ALL - PRE_BUILD - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../misc/preprocess.sh ${ALL_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../include/ALL.hpp ${_glob_comp_def} - ) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../include/ALL.hpp DESTINATION include) - -#install(FILES ${ALL_HEADER_FILES} -# DESTINATION include) +install(FILES ${ALL_HEADER_FILES} + DESTINATION include) if (CM_ALL_FORTRAN) set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../modules)