Skip to content

Commit 2c97103

Browse files
committed
glop: fix cmake build
1 parent 65341f1 commit 2c97103

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

ortools/glop/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# limitations under the License.
1313

1414
file(GLOB _SRCS "*.h" "*.cc")
15+
list(FILTER _SRCS EXCLUDE REGEX ".*/.*_test.cc")
1516
set(NAME ${PROJECT_NAME}_glop)
1617

1718
# Will be merge in libortools.so
@@ -30,3 +31,22 @@ target_link_libraries(${NAME} PRIVATE
3031
protobuf::libprotobuf
3132
${PROJECT_NAMESPACE}::ortools_proto)
3233
#add_library(${PROJECT_NAMESPACE}::glop ALIAS ${NAME})
34+
35+
if(BUILD_TESTING)
36+
# Test
37+
file(GLOB _TEST_SRCS "*_test.cc")
38+
foreach(_FULL_FILE_NAME IN LISTS _TEST_SRCS)
39+
get_filename_component(_NAME ${_FULL_FILE_NAME} NAME_WE)
40+
get_filename_component(_FILE_NAME ${_FULL_FILE_NAME} NAME)
41+
ortools_cxx_test(
42+
NAME
43+
glop_${_NAME}
44+
SOURCES
45+
${_FILE_NAME}
46+
LINK_LIBRARIES
47+
GTest::gtest
48+
GTest::gtest_main
49+
GTest::gmock
50+
)
51+
endforeach()
52+
endif()

0 commit comments

Comments
 (0)