Skip to content

Commit

Permalink
Install pkg-config file on Windows (#534)
Browse files Browse the repository at this point in the history
* Install pkg-config file on Windows

* Install nlopt.pc unconditionally
Thanks to @jschueller.
  • Loading branch information
hattne authored Oct 18, 2023
1 parent 37946d1 commit 3f9cfd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ check_type_size ("unsigned long" SIZEOF_UNSIGNED_LONG)
check_library_exists ("m" sqrt "" HAVE_LIBM)
if (HAVE_LIBM)
set (M_LIBRARY m)
set (LIBS_PRIVATE "-l${M_LIBRARY}")
endif()

if (NOT DEFINED HAVE_FPCLASSIFY)
Expand Down Expand Up @@ -174,10 +175,8 @@ endif ()
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nlopt_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/nlopt_config.h IMMEDIATE)

# pkgconfig file
if (UNIX OR MINGW)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nlopt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/nlopt.pc @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nlopt.pc DESTINATION ${RELATIVE_INSTALL_LIB_DIR}/pkgconfig)
endif ()
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nlopt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/nlopt.pc @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nlopt.pc DESTINATION ${RELATIVE_INSTALL_LIB_DIR}/pkgconfig)

#==============================================================================
# nlopt LIBRARY TARGET (SHARED OR STATIC)
Expand Down
2 changes: 1 addition & 1 deletion nlopt.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Name: NLopt
Description: nonlinear optimization library
Version: @NLOPT_VERSION_STRING@
Libs: -L${libdir} -lnlopt
Libs.private: -lm
Libs.private: @LIBS_PRIVATE@
Cflags: -I${includedir}

0 comments on commit 3f9cfd3

Please sign in to comment.