[Bug 230070] devel/cmake: check_library_exists fails to find libX11/XOpenIM

2018-12-24 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230070

Adriaan de Groot  changed:

   What|Removed |Added

 Resolution|--- |Not A Bug
 Status|In Progress |Closed

--- Comment #4 from Adriaan de Groot  ---
Closing as "that's not how check_library_exists works".

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 230070] devel/cmake: check_library_exists fails to find libX11/XOpenIM

2018-12-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230070

Adriaan de Groot  changed:

   What|Removed |Added

 CC||adr...@freebsd.org

--- Comment #3 from Adriaan de Groot  ---
This is a misunderstanding what CheckLibraryExists does. It takes **one**
LOCATION and checks for the given function in that location. You can pass it a
list, but in CMake's internals -- see CheckLibraryExists.cmake -- it then gets
passed on to try_compile as a string; this loses all the list-ness of LOCATION.

You can see this for yourself by running cmake --debug-trycompile and then
grepping through the resulting CMakeFiles/ directory.

The correct way (well, **one** working way) to look for XOpenIM is to *first*
find the library, then check for the function:

```
find_library(_x11forreal X11 HINTS ${X11_LIB_SEARCH_PATH})
if (_x11forreal)
  check_library_exists(${_x11forreal} XOpenIM "" XIM2_FOUND)
  if(${XIM2_FOUND})
MESSAGE("YES XOpenIM is found (2)")
  else()
MESSAGE("NO XOpenIM is NOT found (2)")
  endif()
endif()
```

This just leaves out the LOCATION and uses the direct path to the library.

Note, also, that X11_LIB_SEARCH_PATH is an internal variable, not documented,
that contains the list of places FindX11.cmake is going to look: it's not a
computed value. So another way to do this is to use the X11 library variable
that **is** documented:

```
check_library_exists(${X11_X11_LIB} XOpenIM "" XIM_FOUND)
```

I'll grant you that the documentation of check_library_exists could be a lot
better.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 230070] devel/cmake: check_library_exists fails to find libX11/XOpenIM

2018-07-29 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230070

Tobias C. Berner  changed:

   What|Removed |Added

  Flags|maintainer-feedback?(kde@Fr |maintainer-feedback+
   |eeBSD.org)  |
 CC||tcber...@freebsd.org
 Status|New |In Progress

--- Comment #2 from Tobias C. Berner  ---
Hi Yuri

I think this is due to /usr/local/{include,lib} not being in  the default
compiler flags.  

If you tell cmake to keep around the test-compile stuff, you should be able to
debug it more easily.

By setting X11_LIB_SEARCH_PATH and passing it as the LOCATION [1] argument, you
obviously help it look there :)  You can see, that [2] simply passes the
LOCATION argument to try_compile as LINK_DIRECTORIES. Which again uses it as
link_directories(${LINK_DIRECTORIES}) [3]. Which you can find here [4].



mfg Tobias

[1] https://cmake.org/cmake/help/v3.12/module/CheckLibraryExists.html
[2]
https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/CheckLibraryExists.cmake#L63
[3] https://cmake.org/cmake/help/v3.12/command/try_compile.html
[4] https://cmake.org/cmake/help/v3.12/command/link_directories.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 230070] devel/cmake: check_library_exists fails to find libX11/XOpenIM

2018-07-26 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230070

--- Comment #1 from Yuri Victorovich  ---
Created attachment 195488
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=195488&action=edit
CMakeLists.txt

-- 
You are receiving this mail because:
You are the assignee for the bug.

maintainer-feedback requested: [Bug 230070] devel/cmake: check_library_exists fails to find libX11/XOpenIM

2018-07-26 Thread bugzilla-noreply
Bugzilla Automation  has asked k...@freebsd.org for
maintainer-feedback:
Bug 230070: devel/cmake: check_library_exists fails to find libX11/XOpenIM
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230070



--- Description ---
The attached CMakeLists.txt fails to find libX11.

'find_package(X11 REQUIRED)' sets
X11_LIB_SEARCH_PATH=/usr/pkg/xorg/lib;/usr/local/lib;/usr/X11R7/lib;/usr/openwi
n/lib;/opt/X11/lib

Despite the correct path /usr/local/lib being in X11_LIB_SEARCH_PATH
check_library_exists still fails to find X11 and XOpenIM in it.

Uncommenting the SET statement allows check_library_exists to find it. This is
weird: shouldn't it have looked in each directory?


[Bug 230070] devel/cmake: check_library_exists fails to find libX11/XOpenIM

2018-07-26 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230070

Bug ID: 230070
   Summary: devel/cmake: check_library_exists fails to find
libX11/XOpenIM
   Product: Ports & Packages
   Version: Latest
  Hardware: Any
OS: Any
Status: New
  Severity: Affects Only Me
  Priority: ---
 Component: Individual Port(s)
  Assignee: k...@freebsd.org
  Reporter: y...@freebsd.org
  Assignee: k...@freebsd.org
 Flags: maintainer-feedback?(k...@freebsd.org)

The attached CMakeLists.txt fails to find libX11.

'find_package(X11 REQUIRED)' sets
X11_LIB_SEARCH_PATH=/usr/pkg/xorg/lib;/usr/local/lib;/usr/X11R7/lib;/usr/openwin/lib;/opt/X11/lib

Despite the correct path /usr/local/lib being in X11_LIB_SEARCH_PATH
check_library_exists still fails to find X11 and XOpenIM in it.

Uncommenting the SET statement allows check_library_exists to find it. This is
weird: shouldn't it have looked in each directory?

-- 
You are receiving this mail because:
You are the assignee for the bug.