[CMake] Finding MinGW compiler libraries?
Bob Paddock
bob.paddock at gmail.com
Sat Jul 26 16:06:58 EDT 2008
On Saturday 26 July 2008 03:28:59 pm Miguel A. Figueroa-Villanueva wrote:
> > My project needs to link against C:\MinGW\lib\libuuid.a, amoung
> > others, but it is not being found.
> >
> > I tried this:
> >
> > find_library( MinGW_Libraries uuid )
>
> find_library(MinGW_Libraries uuid "C:/MinGW/lib")
>
> Does this work?
Yes it did, thank you.
That lead to the discovery that I also need libole32.a and/or libshell32.a
When doing the same thing, the wrong ones are found:
MinGW_libole32 "C:/WINDOWS/system32/ole32.dll"
MinGW_libshell32 "C:/WINDOWS/system32/shell32.dll"
MinGW_libuuid "C:/MinGW/lib/libuuid.a"
Here is my CMakeLists.txt file, what did I do wrong?:
# Source files:
SET( SRCS part_description_aggregator.cpp tiny_xml_dump.cpp )
# wxWidgets is REQUIRED to build this project.
# wxWidgets_FOUND is set to TRUE if wxWidgets was found.
FIND_PACKAGE(wxWidgets REQUIRED base)
INCLUDE(${wxWidgets_USE_FILE})
# Note: wxWidgets_INCLUDE_DIRS is already included by wxWidgets_USE_FILE
INCLUDE_DIRECTORIES(
${part_description_aggregator_SOURCE_DIR}/PartDescriptionXMLAggregator
${part_description_aggregator_SOURCE_DIR}/TinyXPath
)
if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif( COMMAND cmake_policy)
find_library( MinGW_libuuid uuid ole32 shell32 "C:/MinGW/lib" )
find_library( MinGW_libole32 ole32 "C:/MinGW/lib" )
find_library( MinGW_libshell32 shell32 "C:/MinGW/lib" )
# Is there a better way to do the above? What happens when you have dozens of
# libraries?'
ADD_EXECUTABLE(part_description_aggregator WIN32 ${SRCS})
TARGET_LINK_LIBRARIES( part_description_aggregator ${wxWidgets_LIBRARIES}
${MinGW_libuuid} ${MinGW_libole32} ${MinGW_libshell32} TinyXPath )
INSTALL( TARGETS part_description_aggregator RUNTIME DESTINATION bin)
More information about the CMake
mailing list