Default Helper Application Path should not contain spaces

Issue #2342 resolved
Gabriel Nützi created an issue

I have an issue with the "cefsimple" project:

the CMakeList.txt file:

https://bitbucket.org/chromiumembedded/cef/src/7b3d7b85754afc248655e1954d5e83525e75ae72/tests/cefsimple/CMakeLists.txt.in?at=master&fileviewer=file-view-default#CMakeLists.txt.in-46

The Helper Target is set. CMake (at least version 3.9.1) doesn't like spaces in the target name.

* CMake Error at gui/cefsimple/CMakeLists.txt:173 (add_executable): The target name "cefsimple Helper" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior.*

Therefore I needed to patch the CMakeLists.txt file with:

  set(CEF_HELPER_TARGET "cefsimpleHelper")
  set(CEF_HELPER_TARGET_OUTPUTNAME "cefsimple Helper")

...
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
      OUTPUT_NAME ${CEF_HELPER_TARGET_OUTPUTNAME}
  )

Only with this patch, the project configures and builds.

Since the Helper Path is hardcoded in CEF and contains a space "<app> Helper". Anway, why there is a whitespace in the path I dont understand. Normally, I always try to avoid spaces, which only give problems. Why not making the hardcoded path "<app>-Helper", wouldn't that be better?

Comments (9)

  1. Dan Kegel

    (Similarly, pkg-config doesn't like spaces in framework names; its output has to be useful in enough contexts that you just can't get the quoting right. But that's another bug.)

  2. Marshall Greenblatt
    • changed status to open

    Sorry, I missed your report that this has become a fatal error with newer CMake versions. With CMake 3.6 it's just a warning:

    CMake Warning (dev) at tests/cefclient/CMakeLists.txt:457 (add_executable):
      Policy CMP0037 is not set: Target names should not be reserved and should
      match a validity pattern.  Run "cmake --help-policy CMP0037" for policy
      details.  Use the cmake_policy command to set the policy and suppress this
      warning.
    
      The target name "cefclient Helper" is reserved or not valid for certain
      CMake features, such as generator expressions, and may result in undefined
      behavior.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
  3. Gabriel Nützi reporter

    a strange error from cmake. why should cefsimple Helper be reserved lol :)

    Von meinem iPhone gesendet

  4. Felix Bruns

    The problem is that there is a space in the name, which is not allowed in CMake target names. Its error message is a bit confusing.

    The initially suggested fix seems to be the correct one. Rename the CMake target to not have spaces, then configure the output name to conform to Chromium's requirements.

    To fix this issue in another CMake project I used RUNTIME_OUTPUT_NAME instead of the more generic OUTPUT_NAME, though.

  5. Marshall Greenblatt

    @fxb Either RUNTIME_OUTPUT_NAME or OUTPUT_NAME should work in this case since only a runtime executable (cefclient Helper) is created. In general, though, I think using OUTPUT_NAME more closely matches the desired behavior (e.g. runtime, library and archive outputs all receive the output name with spaces instead of the target name without spaces).

  6. Log in to comment