Missing Separator error

Hello everyone :slight_smile:

I get a missing separator error, when I change PRIVATE to PUBLIC specificator in target_include_directories statement. I have 3 shared libraries and I change the specificator only in one (libutils for example), but the others link the first (liboracle, libpostgres).
So, the liboracle is compiled well, but compilation libpostgres generate this error.

seclibs_postgres/CMakeFiles/seclibs_postgres.dir/flags.make:8: *** missing separator.  Stop.

I don’t understand, why?

cmake version 3.21.3
3 short-cut cmakes are below.
libutils:

find_library(Boost_FS boost_filesystem HINTS ${Boost_LIBRARY_DIRS})

add_library(${PROJECT_NAME} SHARED
    logger/Logger.cpp
    helpers.cpp
    strings/CUCS2String.cpp
    strings/CUCS2ErrorManager.cpp
    socket/CUnixSocket.cpp
    socket/SocketConnectorBase.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC
    ${PROJECT_SOURCE_DIR}
    logger
    strings
    socket
    users
    ${Boost_INCLUDE_DIRS})

target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_FS})

liboracle:

add_library(${PROJECT_NAME} SHARED
        seclibs_oracle.cpp
        OracleHelpers.cpp
        OracleString.cpp
        OracleQueryExecutor.cpp
        OracleConnectionManager.cpp)

target_include_directories(${PROJECT_NAME} PRIVATE
        ${ORACLE_INCLUDE_DIR})

if(LINUX)
    target_link_libraries(${PROJECT_NAME} rt utils)
else()
    target_link_libraries(${PROJECT_NAME} ${ORACLE_LIBRARIES} utils)
endif()

libpostgres:

add_library(${PROJECT_NAME} SHARED
    PostgresConnectionManager.cpp
    PostgresHelpers.cpp
    seclibs_postgres.cpp
    PostgresUserFinder.cpp)

target_include_directories(${PROJECT_NAME} PRIVATE
    ${PostgreSQL_INCLUDE_DIR})

if(LINUX)
    target_link_libraries(${PROJECT_NAME} rt utils)
else()
    target_link_libraries(${PROJECT_NAME} rt utils)
endif()

Could you share the line in flags.cmake that has the error?

CXX_INCLUDES = -I/usr/include/pgsql/server
 -I/home/filiptsev/seclibs/utils -I/home/filiptsev/seclibs/utils/logger -I/home/filiptsev/seclibs/utils/strings -I/home/filiptsev/seclibs/utils/socket -I/home/filiptsev/seclibs/utils/users -I/usr/local/boost_1_76_0

The 8th line in file is the second line here. I am not sure that the following is the answer, but cmake didn’t generate symbol ‘’ at the first line end.

It seems that the PostgreSQL_INCLUDE_DIR value has a newline in it. Can you print it out in libpostgres? Something like:

message("PostgreSQL_INCLUDE_DIR: -->${PostgreSQL_INCLUDE_DIR}<--")

so that the beginning and end are marked.

-- Postgres include dir: --->/usr/include/pgsql/server
<-----

Yeah, you are right :slight_smile: Thx, I’ll try use string(STRIP, …) now

If you get it from execute_process, there is OUTPUT_STRIP_TRAILING_WHITESPACE.