wgtmac commented on code in PR #6: URL: https://github.com/apache/iceberg-cpp/pull/6#discussion_r1900615479
########## cmake_modules/BuildUtils.cmake: ########## @@ -201,23 +202,29 @@ function(ADD_ICEBERG_LIB LIB_NAME) PUBLIC "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>") endif() - install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} - EXPORT ${LIB_NAME}_targets + install(TARGETS ${LIB_NAME}_static + EXPORT iceberg_targets ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() - if(ARG_CMAKE_PACKAGE_NAME) - iceberg_install_cmake_package(${ARG_CMAKE_PACKAGE_NAME} ${LIB_NAME}_targets) - endif() - # Modify variable in calling scope if(ARG_OUTPUTS) set(${ARG_OUTPUTS} ${${ARG_OUTPUTS}} PARENT_SCOPE) endif() endfunction() + +function(iceberg_set_export_definitions STATIC_TARGET LIB_TARGETS) + if(ICEBERG_BUILD_STATIC AND WIN32) + target_compile_definitions(${STATIC_TARGET} PUBLIC ICEBERG_STATIC) + endif() + + foreach(LIB_TARGET ${LIB_TARGETS}) + target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_EXPORTING) + endforeach() +endfunction() Review Comment: I cannot make the Windows CI happy after using generate_export_header: https://github.com/apache/iceberg-cpp/actions/runs/12579586949/job/35060023773 ``` demo_puffin.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl iceberg::Puffin::~Puffin(void)" (__imp_??1Puffin@iceberg@@UEAA@XZ) referenced in function "public: virtual __cdecl iceberg::puffin::DemoPuffin::~DemoPuffin(void)" (??1DemoPuffin@puffin@iceberg@@UEAA@XZ) [D:\a\iceberg-cpp\iceberg-cpp\build\src\iceberg\puffin\iceberg_puffin_shared.vcxproj] demo_puffin.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl iceberg::Puffin::Puffin(void)" (__imp_??0Puffin@iceberg@@QEAA@XZ) referenced in function "public: __cdecl iceberg::puffin::DemoPuffin::DemoPuffin(void)" (??0DemoPuffin@puffin@iceberg@@QEAA@XZ) [D:\a\iceberg-cpp\iceberg-cpp\build\src\iceberg\puffin\iceberg_puffin_shared.vcxproj] demo_puffin.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl iceberg::Puffin::Puffin(class iceberg::Puffin const &)" (__imp_??0Puffin@iceberg@@QEAA@AEBV01@@Z) referenced in function "public: __cdecl iceberg::puffin::DemoPuffin::DemoPuffin(class iceberg::puffin::DemoPuffin const &)" (??0DemoPuffin@puffin@iceberg@@QEAA@AEBV012@@Z) [D:\a\iceberg-cpp\iceberg-cpp\build\src\iceberg\puffin\iceberg_puffin_shared.vcxproj] demo_puffin.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class iceberg::Puffin & __cdecl iceberg::Puffin::operator=(class iceberg::Puffin const &)" (__imp_??4Puffin@iceberg@@QEAAAEAV01@AEBV01@@Z) referenced in function "public: class iceberg::puffin::DemoPuffin & __cdecl iceberg::puffin::DemoPuffin::operator=(class iceberg::puffin::DemoPuffin const &)" (??4DemoPuffin@puffin@iceberg@@QEAAAEAV012@AEBV012@@Z) [D:\a\iceberg-cpp\iceberg-cpp\build\src\iceberg\puffin\iceberg_puffin_shared.vcxproj] D:\a\iceberg-cpp\iceberg-cpp\build\src\iceberg\puffin\Debug\iceberg_puffin.dll : fatal error LNK1120: 4 unresolved externals [D:\a\iceberg-cpp\iceberg-cpp\build\src\iceberg\puffin\iceberg_puffin_shared.vcxproj] ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org