[cmake-developers] [CMake 0015301]: FIND_LIBRARY_USE_LIB64_PATHS doesn't work on Windows OSes

Mantis Bug Tracker mantis at public.kitware.com
Fri Dec 12 12:03:51 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15301 
====================================================================== 
Reported By:                jackcmedia
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15301
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-12-12 12:03 EST
Last Modified:              2014-12-12 12:03 EST
====================================================================== 
Summary:                    FIND_LIBRARY_USE_LIB64_PATHS doesn't work on Windows
OSes
Description: 
Setting up a bi-arch cross-compiling script to generate 32 or 64 bit binaries on
demand.

Found that FIND_LIBRARY_USE_LIB64_PATHS doesn't work on Windows, failing to
locate the 64 bit libraries placed on a folder named "lib64". Renaming said
folder to "lib" makes it work as intended.

Steps to Reproduce: 
1.- Install CMake 3.0.2 (TDM-GCC's MinGW-w64 4.9.2 and CLion are my compiler and
IDE of choice, but are not required).

2.- Set up SFML 2.1 64 bits, a third party library, like this:

  include
  lib64 (x64 libs)

and set the CMake (or environmental variable) SFML_ROOT pointing to the root
folder of the third party library.

3.- Create a minimal CMakeLists.txt, like the following:

cmake_minimum_required(VERSION 2.8)
project(CMakeTest LANGUAGES CXX)

if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
  message(WARNING "Target is 64 bits")
else("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
  message(WARNING "Target is 32 bits")
endif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")

set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2.1 REQUIRED graphics system window)

include_directories(${PROJECT_SOURCE_DIR}/)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})

if(SFML_FOUND)
  include_directories(${SFML_INCLUDE_DIR})
  target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES})
endif()

4.- Create a minimal source file, like the following:

#include <SFML/Graphics/RenderWindow.hpp>

int main() {
  sf::RenderWindow window2;
  return 0;
}

5.- Download FindSFML.cmake from
https://github.com/LaurentGomila/SFML/blob/2.1/cmake/Modules/FindSFML.cmake and
add it to the project inside ${PROJECT_SOURCE_DIR}/cmake/Modules.

6.- Try to compile and confirm it fails to locate the libraries.

7.- Rename "lib64" to "lib" and compile again. This time, it's a success.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-12-12 12:03 jackcmedia     New Issue                                    
======================================================================



More information about the cmake-developers mailing list