CMakefile for Gurobi
Hi guys,
I want to debug a project in Clion with Gurobi optimizer. I've searched online a lot but the Cmakefile I created still can't include the Gurobi libraries properly.
I created env variables:
GUROBI_HOME C:\gurobi702\win64
LD_LIBRARY_PATH C:\gurobi702\win64\lib
and added to PATH: C:\gurobi702\win64\bin
And the code I was trying to apply is:
`
cmake_minimum_required(VERSION 3.10)
project(Sudoku C)
set(CMAKE_C_STANDARD 99)
set(GCC_COVERAGE_COMPILE_FLAGS "-ansi -O3 -Wall -Wextra -Werror -pedantic-errors")
add_executable(Sudoku main.c Game.c Game.h)
find_library( GUROBI_LIBRARY
NAMES gurobi
gurobi2010
gurobi2012
gurobi2013
gurobi2015
gurobi70
libgurobi_c++.a
libgurobi70.so
PATHS "$ENV{GUROBI_HOME}/lib"
)
find_library( GUROBI_CXX_LIBRARY
NAMES gurobi_c++
libgurobi70.so
libgurobi_c++.a
PATHS "$ENV{GUROBI_HOME}/lib"
)
set(GUROBI_LIBRARIES "${GUROBI_LIBRARY};${GUROBI_CXX_LIBRARY}" )
include_directories( "$ENV{GUROBI_HOME}/include" )
target_link_libraries( Sudoku ${GUROBI_LIBRARIES} )
set (CMAKE_CXX_FLAGS GCC_COVERAGE_COMPILE_FLAGS "-stdlib=libstdc++")
set (CMAKE_SHARED_LINKER_FLAGS "-lgurobi_c -lgurobi70, --as-needed")
The main error it gave me earlier was that GUROBI_CXX_LIBRARY was not found. After doing a build it showed me:
mingw32-make.exe[3]: *** [CMakeFiles\Sudoku.dir\build.make:152: Sudoku.exe] Error 1 mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:67: CMakeFiles/Sudoku.dir/all] Error 2 mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:79: CMakeFiles/Sudoku.dir/rule] Error 2 mingw32-make.exe: *** [Makefile:117: Sudoku] Error 2
Any ideas on what should be changed? Or to whom else I can address?