Skip to content

Commit c58c71e

Browse files
Merge pull request #309 from jacobwilliams/cmake-on-windows
CMake on Windows
2 parents 2b26675 + 353158a commit c58c71e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.gitignore

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
bin/
22
lib/
33
builds/
4+
build/
5+
install/
46
doc/
7+
58
*.gcov
69
*.gcov.md*
710
*.mod
@@ -14,6 +17,7 @@ files/*.json
1417
*.suo
1518
*.u2d
1619
*.user
20+
*.fdz
1721

1822
visual_studio/Debug/
1923
visual_studio/Release/
@@ -22,4 +26,10 @@ visual_studio/.vs/
2226
visual_studio/jsonfortranlib/
2327
visual_studio/jsonfortrantest/Debug/
2428
visual_studio/jsonfortrantest/Release/
25-
visual_studio/jsonfortrantest/x64
29+
visual_studio/jsonfortrantest/x64
30+
31+
My Amplifier*
32+
My Inspector*
33+
x64/
34+
Debug/
35+
Release/

CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,18 @@ add_library ( ${LIB_NAME}-static STATIC ${JF_LIB_SRCS} )
135135
set_target_properties ( ${LIB_NAME}-static
136136
PROPERTIES
137137
OUTPUT_NAME ${LIB_NAME}
138+
if(NOT MSVC_IDE)
138139
PREFIX lib
140+
endif()
139141
VERSION ${VERSION}
140142
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
141143
Fortran_MODULE_DIRECTORY ${MODULE_DIR} )
142144
set_target_properties ( ${LIB_NAME}
143145
PROPERTIES
144146
OUTPUT_NAME ${LIB_NAME}
147+
if(NOT MSVC_IDE)
145148
PREFIX lib
149+
endif()
146150
SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}
147151
VERSION ${VERSION}
148152
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
@@ -277,6 +281,9 @@ if ( ENABLE_TESTS )
277281
set ( UNIT_TESTS '' )
278282
foreach ( UNIT_TEST ${JF_TEST_SRCS} )
279283
get_filename_component ( TEST ${UNIT_TEST} NAME_WE )
284+
if(MSVC_IDE)
285+
link_directories(${CMAKE_BINARY_DIR}/lib)
286+
endif()
280287
add_executable ( ${TEST} EXCLUDE_FROM_ALL ${UNIT_TEST} )
281288
target_link_libraries ( ${TEST} ${LIB_NAME} )
282289
add_dependencies ( check ${TEST} )
@@ -412,3 +419,8 @@ install(FILES
412419
"${CMAKE_CURRENT_BINARY_DIR}/json-fortran.pc"
413420
DESTINATION "${INSTALL_LIB_DIR}/pkgconfig"
414421
)
422+
423+
if(MSVC_IDE)
424+
INCLUDE_DIRECTORIES("src")
425+
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
426+
endif()

0 commit comments

Comments
 (0)