CMake fails on generate_dll_export_file

已回答

Sometimes running CMake inside CLion fails because the command generate_dll_export_file fails:

---snip---

CMake Error at C:/Users/philippe.payant/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/193.6015.37/bin/cmake/win/share/cmake-3.15/Modules/GenerateExportHeader.cmake:394 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
C:/Users/philippe.payant/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/193.6015.37/bin/cmake/win/share/cmake-3.15/Modules/GenerateExportHeader.cmake:410 (_do_generate_export_header)
cmake/dll-export-helper.cmake:4 (generate_export_header)
domain/Lidar/CMakeLists.txt:58 (generate_dll_export_file)

---snip---

I believe the reason is that CLion runs CMake for debug and release at the same time and then generate_dll_export_file fails (sometimes) because both generations are trying to write to the same output file (our DLL export header files are placed inside the source tree).

Anybody else has this issue?

Is there a good technique for placing the export header files in the generated project directory instead of the source tree?

Is there a way to get CLion to regen debug or release separately?

Any suggestion would be appreciated.

0

Hello!

  1. Currently there is no possibility to run CMake for debug and release separately. Feel free to create a feature request in our tracker: https://youtrack.jetbrains.com/issues/CPP.
  2. In order to put a generated file into the build directory you can use the EXPORT_FILE_NAME argument of the GENERATE_EXPORT_HEADER command. For example, EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/some_header.h.
  3. You can either disable generation of these headers in one of the profiles, or check whether headers are already generated and not regenerate them.
0

请先登录再写评论。