[ 
https://issues.apache.org/jira/browse/LOGCXX-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183840#comment-17183840
 ] 

Thorsten Schöning commented on LOGCXX-510:
------------------------------------------

Does running tests work for you in Windows and Visual Studio 2019?

The current handling of PATH seems wrong. Test can't find "sed.exe" etc. this 
way and the handling of ";" to provide multiple paths seems difficult as well. 
When setting ENVIRONMENT, ";" seems to be used to distinguish different pairs 
of key and value and PATH with ";" to combine multiple directories can't easily 
work this way. People suggest using "\\$<SEMICOLON>" and "$ENV{PATH}" or 
something like that, but things didn't succeed for me. Only the first entry of 
PATH seems to be used, regardless what I try.

https://stackoverflow.com/questions/48954920/trouble-setting-environment-variables-for-ctest-tests

{quote}
        get_filename_component(APR_DLL_DIR "${APR_DLL}" DIRECTORY)
        get_filename_component(APR_UTIL_DLL_DIR "${APR_UTIL_DLL}" DIRECTORY)
        get_filename_component(LOG4CXX_DLL_DIR "${CMAKE_INSTALL_PREFIX}\\bin" 
DIRECTORY)
        get_filename_component(XMLLIB_DLL_DIR "${XMLLIB_DLL}" DIRECTORY)

        set(PATH_FOR_TESTS 
${APR_DLL_DIR}\\$<SEMICOLON>${APR_UTIL_DLL_DIR}\\$<SEMICOLON>${LOG4CXX_DLL_DIR}\\$<SEMICOLON>C:\\Users\\tschoening\\Documents\\Svn\\Src\\Libs\\trunk\\C\\XML\\libexpat\\2.2.9\\src\\expat\\out\\install\\x64-Debug\\bin)
{quote}

XMLLIB_DLL doesn't seem to be configured anywhere, so it's either not used or a 
problem as well.

"$<SHELL_PATH:$<TARGET_FILE_DIR:log4cxx>>" doesn't resolve for me whatever I 
do, therefore I used a different approach which at least provides a directory 
usable for "PATH_FOR_TESTS".

We need some way to APPEND to PATH instead of replacing it, which should be 
possible as well in theory, but didn't work for me:

{quote}
           set_property(TEST ${testName} APPEND PROPERTY
                ENVIRONMENT "PATH=${APR_DLL_DIR}"
           )
           set_property(TEST ${testName} APPEND PROPERTY
                ENVIRONMENT "PATH=${APR_UTIL_DLL_DIR}"
           )
           set_property(TEST ${testName} APPEND PROPERTY
                ENVIRONMENT "PATH=${LOG4CXX_DLL_DIR}"
           )
           set_tests_properties(${testName} PROPERTIES
                ENVIRONMENT "TOTO=wonderful;key1=value1;key2=value2"
           )
{quote}

https://cmake.org/cmake/help/latest/command/set_property.html

In ProcMon, I can see clearly that this DOES NOT replace PATH, the default 
entries of that are searched for missing DLLs like expected. It's only that 
newly added values are NOT searched anymore. :-/

> Build problems using CMAKE and Visual Studio 2019 Community
> -----------------------------------------------------------
>
>                 Key: LOGCXX-510
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-510
>             Project: Log4cxx
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 0.11.0
>            Reporter: Thorsten Schöning
>            Assignee: Thorsten Schöning
>            Priority: Major
>         Attachments: CMP00079.png, CMakeSettings.json, 
> cmake_settings_using_vs_gui.zip, missing_log4cxx_rc.png, 
> set_target_properties.png
>
>
> I just tested building log4cxx using CMAKE and Visual Studio 2019 Community. 
> Things failed and I want to use this bug to document everything that I've 
> found, because for some things I'm not sure how to handle them properly. Will 
> create a new branch to maintain the fixes I came along, so that those can at 
> best be later reviewed by others. The branch of interest is currently named 
> "logcxx_510_cmake_vs2019_compat".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to