Comments (9)
However, when downstream or individual programs call this header file, they are not obligated to pass this macro at compile time, and may not necessarily know that it needs to be passed. This can lead to the inclusion of the aforementioned header files, potentially causing issues with header file not found.
from poco.
Firstly, add the installation of headers from the
sql-parser
in the file https://github.com/pocoproject/poco/blob/devel/Data/CMakeLists.txt. This would ensure that the headers can be found, at least whenPOCO_DATA_NO_SQL_PARSER
is set to off.
I'm not sure what "installation of headers from the sql-parser
" exactly refers to - path to headers is there unconditionally:
Line 44 in 48d7a3e
Secondly, redesign a forward-working macro to replace
POCO_DATA_NO_SQL_PARSER
, such asPOCO_DATA_SQL_PARSER
or another more appropriate name. which defaults to ON. It defaults to ON, and in the header files, check if it is defined before including headers likesql-parser/src/SQLParser.h
.
Sounds like inverse logic resulting in the same situation where SQLParser is present by default, and must be explicitly excluded. While you are helping the clients who are using the build without SQLParser, what about the users who want it and now explicitly have to enable it?
As far as I see at the moment, only an additional level of indirection can resolve this situation - in order to be able to remove the #include SQLParser.h
in Statement.h
, all SQLParser dependencies should be moved to a separate class, which would allow forward declaration in Statement.h
and removal of the #include SQLParser.h
. I suggest to think it over and propose the change through pull request - it will be much easier to discuss. Since this would be a breaking change, it can't go in before 1.14
from poco.
Or maybe the issue is that the header files in the sql-parser
subdirectory don't get installed at all. Regardless of whether or not the parser is enabled π€
from poco.
Therefore, I think it would probably make sense to add some conditional including at some point. Most logical to me would seem to guard the includes of
SQLParser.h
itself.
But there is conditional including in the SQLParser.h
itself.:
poco/Data/include/Poco/Data/SQLParser.h
Lines 23 to 28 in 48d7a3e
from poco.
What exactly are you proposing to do here? Wrap #include "SQLParser.h"
into ifdefs? I don't see how would that solve the described problem?
from poco.
Firstly, add the installation of headers from the sql-parser
in the file https://github.com/pocoproject/poco/blob/devel/Data/CMakeLists.txt. This would ensure that the headers can be found, at least when POCO_DATA_NO_SQL_PARSER
is set to off.
Secondly, redesign a forward-working macro to replace POCO_DATA_NO_SQL_PARSER
, such as POCO_DATA_SQL_PARSER
or another more appropriate name. which defaults to ON. It defaults to ON, and in the header files, check if it is defined before including headers like sql-parser/src/SQLParser.h
.
from poco.
The "installation of headers from the sql-parser
" I referred to is the operation that directly copies specific header files to a designated location, as demonstrated in the following code:
install(
DIRECTORY include/Poco
DESTINATION include
COMPONENT Devel
PATTERN ".svn" EXCLUDE
)
The mentioned $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
only adds that path to the include directories during compilation and does not actually copy files.
I fully agree with the solution you proposed. Before it is completed and released, I will add the following patch to this PR to ensure that the issue of missing header files does not occur again in vcpkg.
diff --git a/Data/CMakeLists.txt b/Data/CMakeLists.txt
index 72da6df..12a2870 100644
--- a/Data/CMakeLists.txt
+++ b/Data/CMakeLists.txt
@@ -49,6 +49,20 @@ target_include_directories(Data
POCO_INSTALL(Data)
POCO_GENERATE_PACKAGE(Data)
+if (NOT POCO_DATA_NO_SQL_PARSER)
+ file(GLOB HEADERS "${CMAKE_CURRENT_LIST_DIR}/src/sql-parser/src/*.h")
+ install(FILES ${HEADERS} DESTINATION "include/Poco/Data/sql-parser/src")
+
+ file(GLOB HEADERS "${CMAKE_CURRENT_LIST_DIR}/src/sql-parser/src/parser/*.h")
+ install(FILES ${HEADERS} DESTINATION "include/Poco/Data/sql-parser/src/parser")
+
+ file(GLOB HEADERS "${CMAKE_CURRENT_LIST_DIR}/src/sql-parser/src/sql/*.h")
+ install(FILES ${HEADERS} DESTINATION "include/Poco/Data/sql-parser/src/sql")
+
+ file(GLOB HEADERS "${CMAKE_CURRENT_LIST_DIR}/src/sql-parser/src/util/*.h")
+ install(FILES ${HEADERS} DESTINATION "include/Poco/Data/sql-parser/src/util")
+endif()
+
if(ENABLE_TESTS)
add_subdirectory(testsuite)
endif()
from poco.
Thank you for your fix. But even if you
- modify the file "Data/CMakeLists.txt" according your patch
- and set "-DPOCO_DATA_NO_SQL_PARSER=ON" for cmake
the file "Config.h" (after the installation with "cmake --build . --target install") won't be updated with
#define POCO_DATA_NO_SQL_PARSER
(in my case it's "/usr/local/include/Poco/Config.h")
from poco.
I have modified my fix solution in vcpkg. The current result is that the header files under sql-parser
are always installed, regardless of whether the value of POCO_DATA_NO_SQL_PARSER
is ON or OFF. This ensures that the sql-parser
header files can always be found whenever there is a call to them.
from poco.
Related Issues (20)
- qnx build error: 'prctl' was not declared in this scope HOT 1
- call of overloaded βbind is ambiguous ( Poco::Data::Keywords::useRef + Poco::Nullable<bool> + const_iterator) HOT 4
- Add string_view format type spec
- NULL pointer: strategy when setting rotation never in FileChannel
- StreamCopier range support
- Improve NotificationCenter speed and usability HOT 4
- SecureSocketImpl::reset shouldn't close socket HOT 1
- Simple header file cannot be parsed with CppParser component HOT 5
- Multiple calls to initializeSSL/uninitializeSSL cause assert failure during certificate validation HOT 1
- `Dynamic::Var` silently loses precision on int->float conversion HOT 2
- Unit tests: optional testing of deprecated functionality HOT 1
- Remove deprecated code HOT 2
- Consolidate LogFile implementation to use FileOutputStream HOT 1
- Make LIBRARY_OUTPUT_DIRECTORY a cache entry (editable) HOT 1
- SecureStreamSocket is not thread-safe
- Add arm cross-compile config and CI
- Enable CodeQL fail if error found
- Documentation generation
- CppParser: Support unions
- Upgrade libexpat to 2.6.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poco.